diff --git a/cns/requestcontroller/kubecontroller/crdrequestcontroller_test.go b/cns/requestcontroller/kubecontroller/crdrequestcontroller_test.go index 1d451320ca..753d19c7eb 100644 --- a/cns/requestcontroller/kubecontroller/crdrequestcontroller_test.go +++ b/cns/requestcontroller/kubecontroller/crdrequestcontroller_test.go @@ -592,7 +592,7 @@ func TestInitRequestController(t *testing.T) { }, }, SubnetAddressSpace: subnetRange, - Version: "1", + Version: 1, }, }, }, diff --git a/cns/requestcontroller/kubecontroller/crdtranslator.go b/cns/requestcontroller/kubecontroller/crdtranslator.go index cb0a79d62e..4a57a68030 100644 --- a/cns/requestcontroller/kubecontroller/crdtranslator.go +++ b/cns/requestcontroller/kubecontroller/crdtranslator.go @@ -37,7 +37,7 @@ func CRDStatusToNCRequest(crdStatus nnc.NodeNetworkConfigStatus) (cns.CreateNetw ncRequest.SecondaryIPConfigs = make(map[string]cns.SecondaryIPConfig) ncRequest.NetworkContainerid = nc.ID ncRequest.NetworkContainerType = cns.Docker - ncRequest.Version = nc.Version + ncRequest.Version = strconv.FormatInt(nc.Version, 10) if ip = net.ParseIP(nc.PrimaryIP); ip == nil { return ncRequest, fmt.Errorf("Invalid PrimaryIP %s:", nc.PrimaryIP) diff --git a/cns/requestcontroller/kubecontroller/crdtranslator_test.go b/cns/requestcontroller/kubecontroller/crdtranslator_test.go index e34053950e..7fcb6fbffc 100644 --- a/cns/requestcontroller/kubecontroller/crdtranslator_test.go +++ b/cns/requestcontroller/kubecontroller/crdtranslator_test.go @@ -1,7 +1,6 @@ package kubecontroller import ( - "strconv" "testing" "github.com/Azure/azure-container-networking/cns" @@ -18,7 +17,7 @@ const ( subnetAddressSpace = "10.0.0.0/24" subnetPrefixLen = 24 testSecIp1 = "10.0.0.2" - version = "1" + version = 1 ) func TestStatusToNCRequestMalformedPrimaryIP(t *testing.T) { @@ -237,8 +236,7 @@ func TestStatusToNCRequestSuccess(t *testing.T) { t.Fatalf("Expected %v as the secondary IP config but got %v", testSecIp1, secondaryIP.IPAddress) } - ncVersionInInt, _ := strconv.Atoi(version) - if secondaryIP.NCVersion != ncVersionInInt { - t.Fatalf("Expected %d as the secondary IP config NC version but got %v", ncVersionInInt, secondaryIP.NCVersion) + if secondaryIP.NCVersion != version { + t.Fatalf("Expected %d as the secondary IP config NC version but got %v", version, secondaryIP.NCVersion) } } diff --git a/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go b/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go index 57722fde59..f33e7ac3c4 100644 --- a/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go +++ b/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go @@ -72,7 +72,7 @@ type NetworkContainer struct { IPAssignments []IPAssignment `json:"ipAssignments,omitempty"` DefaultGateway string `json:"defaultGateway,omitempty"` SubnetAddressSpace string `json:"subnetAddressSpace,omitempty"` - Version string `json:"version,omitempty"` + Version int64 `json:"version,omitempty"` } // IPAssignment groups an IP address and Name. Name is a UUID set by the the IP address assigner. diff --git a/nodenetworkconfig/manifests/acn.azure.com_nodenetworkconfigs.yaml b/nodenetworkconfig/manifests/acn.azure.com_nodenetworkconfigs.yaml index a94868af2e..21747bfc64 100644 --- a/nodenetworkconfig/manifests/acn.azure.com_nodenetworkconfigs.yaml +++ b/nodenetworkconfig/manifests/acn.azure.com_nodenetworkconfigs.yaml @@ -76,7 +76,8 @@ spec: subnetName: type: string version: - type: string + format: int64 + type: integer type: object type: array scaler: