From 9b1da7e974658e44120e25726c73a287d6fc3e15 Mon Sep 17 00:00:00 2001 From: Ashish Nair Date: Fri, 8 Sep 2023 11:39:17 -0700 Subject: [PATCH] Feat: Created a Network Container Status Section to be updated with the latest error code (#2193) * Added Network Conatiner Status to include the latest error code for a Network Container * Updated the crd to have the Status field included into the Network Container * Updated the names and added Status and ErrorText as two fields in NC Status * Fixed the casing and json values for these variables * Added error code to the NC Status and removed the latest prefix from the varibale names * Removed the timestamp variable from the NC Status * Moved the Status object inside the NC Status to be able to accurately define the status of each NC for the node * Changed to having an enum representing the NC Status which DNC-RC will update after inferring the error and CNS can use this field to propagate and NCRequest failures * Made the validation of the new enum optional to keep it backward compatible --- .../api/v1alpha/nodenetworkconfig.go | 22 ++++++++++++++----- .../acn.azure.com_nodenetworkconfigs.yaml | 5 +++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go b/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go index 4b96ea5ff6..8f91bf154d 100644 --- a/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go +++ b/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go @@ -58,6 +58,15 @@ const ( Error Status = "Error" ) +// NCStatus indicates the latest NC request status +// +kubebuilder:validation:Enum=SubnetFull +// +kubebuilder:validation:Optional +type NCStatus string + +const ( + NCStatusSubnetFull NCStatus = "SubnetFull" +) + // NodeNetworkConfigStatus defines the observed state of NetworkConfig type NodeNetworkConfigStatus struct { // +kubebuilder:default=0 @@ -107,12 +116,13 @@ type NetworkContainer struct { SubnetAddressSpace string `json:"subnetAddressSpace,omitempty"` // +kubebuilder:default=0 // +kubebuilder:validation:Optional - Version int64 `json:"version"` - NodeIP string `json:"nodeIP,omitempty"` - SubscriptionID string `json:"subcriptionID,omitempty"` - ResourceGroupID string `json:"resourceGroupID,omitempty"` - VNETID string `json:"vnetID,omitempty"` - SubnetID string `json:"subnetID,omitempty"` + Version int64 `json:"version"` + NodeIP string `json:"nodeIP,omitempty"` + SubscriptionID string `json:"subcriptionID,omitempty"` + ResourceGroupID string `json:"resourceGroupID,omitempty"` + VNETID string `json:"vnetID,omitempty"` + SubnetID string `json:"subnetID,omitempty"` + Status NCStatus `json:"status,omitempty"` } // IPAssignment groups an IP address and Name. Name is a UUID set by the the IP address assigner. diff --git a/crd/nodenetworkconfig/manifests/acn.azure.com_nodenetworkconfigs.yaml b/crd/nodenetworkconfig/manifests/acn.azure.com_nodenetworkconfigs.yaml index 901b878280..04b5a01f4d 100644 --- a/crd/nodenetworkconfig/manifests/acn.azure.com_nodenetworkconfigs.yaml +++ b/crd/nodenetworkconfig/manifests/acn.azure.com_nodenetworkconfigs.yaml @@ -115,6 +115,11 @@ spec: type: string resourceGroupID: type: string + status: + description: NCStatus indicates the latest NC request status + enum: + - SubnetFull + type: string subcriptionID: type: string subnetAddressSpace: