Skip to content

Commit

Permalink
Saved the updated NC Status into the CNS statefile
Browse files Browse the repository at this point in the history
  • Loading branch information
nairashu authored Sep 9, 2023
1 parent 41b65b3 commit 06751ed
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 43 deletions.
6 changes: 3 additions & 3 deletions cns/NetworkContainerContract.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ type CreateNetworkContainerRequest struct {
AllowHostToNCCommunication bool
AllowNCToHostCommunication bool
EndpointPolicies []NetworkContainerRequestPolicies
NCStatus v1alpha.NetworkContainerStatus
NCStatus v1alpha.NCStatus
}

// CreateNetworkContainerRequest implements fmt.Stringer for logging
func (req *CreateNetworkContainerRequest) String() string {
return fmt.Sprintf("CreateNetworkContainerRequest"+
"{Version: %s, NetworkContainerType: %s, NetworkContainerid: %s, PrimaryInterfaceIdentifier: %s, "+
"LocalIPConfiguration: %+v, IPConfiguration: %+v, SecondaryIPConfigs: %+v, MultitenancyInfo: %+v, "+
"AllowHostToNCCommunication: %t, AllowNCToHostCommunication: %t}",
"AllowHostToNCCommunication: %t, AllowNCToHostCommunication: %t, NCStatus: %s}",
req.Version, req.NetworkContainerType, req.NetworkContainerid, req.PrimaryInterfaceIdentifier, req.LocalIPConfiguration,
req.IPConfiguration, req.SecondaryIPConfigs, req.MultiTenancyInfo, req.AllowHostToNCCommunication, req.AllowNCToHostCommunication)
req.IPConfiguration, req.SecondaryIPConfigs, req.MultiTenancyInfo, req.AllowHostToNCCommunication, req.AllowNCToHostCommunication, string(req.NCStatus))
}

// NetworkContainerRequestPolicies - specifies policies associated with create network request
Expand Down
1 change: 0 additions & 1 deletion cns/ipampool/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ func (pm *Monitor) Start(ctx context.Context) error {
pm.metastate.subnet = nnc.Status.NetworkContainers[0].SubnetName
pm.metastate.subnetCIDR = nnc.Status.NetworkContainers[0].SubnetAddressSpace
pm.metastate.subnetARMID = GenerateARMID(&nnc.Status.NetworkContainers[0])
pm.metastate.nncStatus = nnc.Status.NetworkContainers[0].UpdateStatus
}
pm.metastate.primaryIPAddresses = make(map[string]struct{})
// Add Primary IP to Map, if not present.
Expand Down
2 changes: 1 addition & 1 deletion cns/kubecontroller/nodenetworkconfig/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func CreateNCRequestFromDynamicNC(nc v1alpha.NetworkContainer) (*cns.CreateNetwo
IPSubnet: subnet,
GatewayIPAddress: nc.DefaultGateway,
},
NCStatus: nc.UpdateStatus,
NCStatus: nc.Status,
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion cns/kubecontroller/nodenetworkconfig/conversion_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ func createNCRequestFromStaticNCHelper(nc v1alpha.NetworkContainer, primaryIPPre
IPSubnet: subnet,
GatewayIPAddress: nc.DefaultGateway,
},
NCStatus: nc.UpdateStatus,
NCStatus: nc.Status,
}, nil
}
2 changes: 1 addition & 1 deletion cns/kubecontroller/nodenetworkconfig/conversion_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ func createNCRequestFromStaticNCHelper(nc v1alpha.NetworkContainer, primaryIPPre
IPSubnet: subnet,
GatewayIPAddress: nc.DefaultGateway,
},
NCStatus: nc.UpdateStatus,
NCStatus: nc.Status,
}, nil
}
7 changes: 0 additions & 7 deletions crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ type NodeNetworkConfigStatus struct {
NetworkContainers []NetworkContainer `json:"networkContainers,omitempty"`
}

// NetworkContainerStatus defines the status of the Network Containers
type NetworkContainerStatus struct {
Timestamp metav1.Time `json:"timestamp,omitempty"`
LatestStatus string `json:"latestStatus,omitempty"`
LatestErrorText string `json:"latestErrorText,omitempty"`
}

// Scaler groups IP request params together
type Scaler struct {
BatchSize int64 `json:"batchSize,omitempty"`
Expand Down
17 changes: 0 additions & 17 deletions crd/nodenetworkconfig/api/v1alpha/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,6 @@ spec:
description: NCType is the specific type of network this NC
represents.
type: string
updateStatus:
description: NetworkContainerStatus defines the status of the
Network Containers
properties:
latestErrorText:
type: string
latestStatus:
type: string
timestamp:
format: date-time
type: string
type: object
version:
default: 0
format: int64
Expand Down

0 comments on commit 06751ed

Please sign in to comment.