Skip to content

Commit e9741df

Browse files
thatmattlongMatthew Long
andauthored
Use int64 for NC version in NNC (#721)
* update cns tag in yaml * pipeline cleanup * Use int64 for NC version in NNC status Co-authored-by: Matthew Long <[email protected]> Co-authored-by: Matthew Long <[email protected]>
1 parent cc2aab5 commit e9741df

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

cns/requestcontroller/kubecontroller/crdrequestcontroller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ func TestInitRequestController(t *testing.T) {
592592
},
593593
},
594594
SubnetAddressSpace: subnetRange,
595-
Version: "1",
595+
Version: 1,
596596
},
597597
},
598598
},

cns/requestcontroller/kubecontroller/crdtranslator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func CRDStatusToNCRequest(crdStatus nnc.NodeNetworkConfigStatus) (cns.CreateNetw
3737
ncRequest.SecondaryIPConfigs = make(map[string]cns.SecondaryIPConfig)
3838
ncRequest.NetworkContainerid = nc.ID
3939
ncRequest.NetworkContainerType = cns.Docker
40-
ncRequest.Version = nc.Version
40+
ncRequest.Version = strconv.FormatInt(nc.Version, 10)
4141

4242
if ip = net.ParseIP(nc.PrimaryIP); ip == nil {
4343
return ncRequest, fmt.Errorf("Invalid PrimaryIP %s:", nc.PrimaryIP)

cns/requestcontroller/kubecontroller/crdtranslator_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package kubecontroller
22

33
import (
4-
"strconv"
54
"testing"
65

76
"github.com/Azure/azure-container-networking/cns"
@@ -18,7 +17,7 @@ const (
1817
subnetAddressSpace = "10.0.0.0/24"
1918
subnetPrefixLen = 24
2019
testSecIp1 = "10.0.0.2"
21-
version = "1"
20+
version = 1
2221
)
2322

2423
func TestStatusToNCRequestMalformedPrimaryIP(t *testing.T) {
@@ -237,8 +236,7 @@ func TestStatusToNCRequestSuccess(t *testing.T) {
237236
t.Fatalf("Expected %v as the secondary IP config but got %v", testSecIp1, secondaryIP.IPAddress)
238237
}
239238

240-
ncVersionInInt, _ := strconv.Atoi(version)
241-
if secondaryIP.NCVersion != ncVersionInInt {
242-
t.Fatalf("Expected %d as the secondary IP config NC version but got %v", ncVersionInInt, secondaryIP.NCVersion)
239+
if secondaryIP.NCVersion != version {
240+
t.Fatalf("Expected %d as the secondary IP config NC version but got %v", version, secondaryIP.NCVersion)
243241
}
244242
}

nodenetworkconfig/api/v1alpha/nodenetworkconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ type NetworkContainer struct {
7272
IPAssignments []IPAssignment `json:"ipAssignments,omitempty"`
7373
DefaultGateway string `json:"defaultGateway,omitempty"`
7474
SubnetAddressSpace string `json:"subnetAddressSpace,omitempty"`
75-
Version string `json:"version,omitempty"`
75+
Version int64 `json:"version,omitempty"`
7676
}
7777

7878
// IPAssignment groups an IP address and Name. Name is a UUID set by the the IP address assigner.

nodenetworkconfig/manifests/acn.azure.com_nodenetworkconfigs.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ spec:
7676
subnetName:
7777
type: string
7878
version:
79-
type: string
79+
format: int64
80+
type: integer
8081
type: object
8182
type: array
8283
scaler:

0 commit comments

Comments
 (0)