Skip to content

Commit c0d8823

Browse files
authored
move mode to NC and add type (#1331)
Signed-off-by: Evan Baker <[email protected]>
1 parent 7fb08d9 commit c0d8823

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,19 @@ type NodeNetworkConfigSpec struct {
4545
IPsNotInUse []string `json:"ipsNotInUse,omitempty"`
4646
}
4747

48-
// Mode is the type of Pod Subnet we are operating in
49-
// +kubebuilder:validation:Enum=swift;overlay
50-
type Mode string
48+
// Status indicates the NNC reconcile status
49+
// +kubebuilder:validation:Enum=Updating;Updated;Error
50+
type Status string
5151

5252
const (
53-
Overlay Mode = "overlay"
54-
Swift Mode = "swift"
53+
Updating Status = "Updating"
54+
Updated Status = "Updated"
55+
Error Status = "Error"
5556
)
5657

5758
// NodeNetworkConfigStatus defines the observed state of NetworkConfig
5859
type NodeNetworkConfigStatus struct {
59-
AssignedIPCount int `json:"assignedIPCount,omitempty"`
60-
// +kubebuilder:default=swift
61-
Mode Mode `json:"mode,omitempty"`
60+
AssignedIPCount int `json:"assignedIPCount,omitempty"`
6261
Scaler Scaler `json:"scaler,omitempty"`
6362
Status Status `json:"status,omitempty"`
6463
NetworkContainers []NetworkContainer `json:"networkContainers,omitempty"`
@@ -72,19 +71,29 @@ type Scaler struct {
7271
MaxIPCount int64 `json:"maxIPCount,omitempty"`
7372
}
7473

75-
// Status indicates the NNC reconcile status
76-
// +kubebuilder:validation:Enum=Updating;Updated;Error
77-
type Status string
74+
// AssignmentMode is whether we are allocated an entire block or IP by IP.
75+
// +kubebuilder:validation:Enum=dynamic;static
76+
type AssignmentMode string
7877

7978
const (
80-
Updating Status = "Updating"
81-
Updated Status = "Updated"
82-
Error Status = "Error"
79+
Dynamic AssignmentMode = "dynamic"
80+
Static AssignmentMode = "static"
81+
)
82+
83+
// NCType is the specific type of network this NC represents.
84+
type NCType string
85+
86+
const (
87+
VNET NCType = "vnet"
88+
Overlay NCType = "overlay"
8389
)
8490

8591
// NetworkContainer defines the structure of a Network Container as found in NetworkConfigStatus
8692
type NetworkContainer struct {
87-
ID string `json:"id,omitempty"`
93+
ID string `json:"id,omitempty"`
94+
// +kubebuilder:default=dynamic
95+
AssignmentMode AssignmentMode `json:"assignmentMode,omitempty"`
96+
Type NCType `json:"type,omitempty"`
8897
PrimaryIP string `json:"primaryIP,omitempty"`
8998
SubnetName string `json:"subnetName,omitempty"`
9099
IPAssignments []IPAssignment `json:"ipAssignments,omitempty"`

crd/nodenetworkconfig/manifests/acn.azure.com_nodenetworkconfigs.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,19 @@ spec:
7373
properties:
7474
assignedIPCount:
7575
type: integer
76-
mode:
77-
default: swift
78-
description: Mode is the type of Pod Subnet we are operating in
79-
enum:
80-
- swift
81-
- overlay
82-
type: string
8376
networkContainers:
8477
items:
8578
description: NetworkContainer defines the structure of a Network
8679
Container as found in NetworkConfigStatus
8780
properties:
81+
assignmentMode:
82+
default: dynamic
83+
description: AssignmentMode is whether we are allocated an entire
84+
block or IP by IP.
85+
enum:
86+
- dynamic
87+
- static
88+
type: string
8889
defaultGateway:
8990
type: string
9091
id:
@@ -114,6 +115,10 @@ spec:
114115
type: string
115116
subnetName:
116117
type: string
118+
type:
119+
description: NCType is the specific type of network this NC
120+
represents.
121+
type: string
117122
version:
118123
format: int64
119124
type: integer

0 commit comments

Comments
 (0)