@@ -9,41 +9,41 @@ import (
99 corev1 "github.com/ironcore-dev/network-operator/api/core/v1alpha1"
1010)
1111
12- // VPCSpec defines the desired state of VPC (Cisco's NXOS Virtual Port Channel)
13- type VPCSpec struct {
12+ // VPCDomainSpec defines the desired state of a VPC domain ( Virtual Port Channel Domain )
13+ type VPCDomainSpec struct {
1414 // DeviceName is the name of the Device this object belongs to. The Device object must exist in the same namespace.
1515 // Immutable.
1616 // +required
1717 // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="DeviceRef is immutable"
1818 DeviceRef corev1.LocalObjectReference `json:"deviceRef"`
1919
20- // DomainID is the vPC domain ID (1-1000).
21- // This uniquely identifies the vPC domain and must match on both peer switches.
22- // Maps to: "vpc domain <DomainID>"
23- // Changing this value will recreate the vPC domain and flap the peer-link and vPCs .
20+ // DomainID is the vPCDomain domain ID (1-1000).
21+ // This uniquely identifies the vPCDomain domain and must match on both peer switches.
22+ // Maps to: "vpcdomain domain <DomainID>"
23+ // Changing this value will recreate the vPCDomain domain and flap the peer-link and vPCDomains .
2424 // +required
2525 // +kubebuilder:validation:Minimum=1
2626 // +kubebuilder:validation:Maximum=1000
2727 DomainID uint16 `json:"domainId"`
2828
29- // AdminState is the administrative state of the vPC domain (enabled/disabled).
30- // When disabled, the vPC domain is administratively shut down.
31- // Maps to: "vpc domain <id>" being present (enabled) or "no vpc domain <id>" (disabled)
29+ // AdminState is the administrative state of the vPCDomain domain (enabled/disabled).
30+ // When disabled, the vPCDomain domain is administratively shut down.
31+ // Maps to: "vpcdomain domain <id>" being present (enabled) or "no vpcdomain domain <id>" (disabled)
3232 // +required
3333 // +kubebuilder:default="enabled"
3434 // +kubebuilder:validation:Enum=enabled;disabled
3535 AdminState string `json:"adminState"`
3636
37- // RolePriority is the role priority for this vPC domain (1-65535).
37+ // RolePriority is the role priority for this vPCDomain domain (1-65535).
3838 // The switch with the lower role priority becomes the operational primary.
3939 // Maps to: "role priority <RolePriority>"
4040 // +required
4141 // +kubebuilder:validation:Minimum=1
4242 // +kubebuilder:validation:Maximum=65535
4343 RolePriority uint16 `json:"rolePriority"`
4444
45- // SystemPriority is the system priority for this vPC domain (1-65535).
46- // Used to ensure that the vPC devices are primary devices on LACP. Must match on both peers.
45+ // SystemPriority is the system priority for this vPCDomain domain (1-65535).
46+ // Used to ensure that the vPCDomain devices are primary devices on LACP. Must match on both peers.
4747 // Maps to: "system-priority <SystemPriority>"
4848 // +optional
4949 // +kubebuilder:validation:Minimum=1
@@ -58,59 +58,59 @@ type VPCSpec struct {
5858 // +kubebuilder:validation:Maximum=3600
5959 DelayRestoreSVI uint16 `json:"delayRestoreSVI"`
6060
61- // DelayRestoreVPC is the delay in seconds (1-3600) before bringing up vPC member ports after the peer-link is restored.
62- // This ensures the vPC peer-link is stable before enabling member ports.
61+ // DelayRestoreVPC is the delay in seconds (1-3600) before bringing up the member ports after the peer-link is restored.
6362 // Maps to: "delay restore <DelayRestoreVPC>"
6463 // +required
6564 // +kubebuilder:validation:Minimum=1
6665 // +kubebuilder:validation:Maximum=3600
6766 DelayRestoreVPC uint16 `json:"delayRestoreVPC"`
6867
69- // FastConvergence fosters faster convergence for vPC when enabled.
68+ // FastConvergence ensures that both SVIs and member ports are shut down simultaneously when the peer-link goes down.
69+ // This sinchronization helps prevent traffic loss.
7070 // Maps to: "fast-convergence" when enabled
7171 // +required
7272 FastConvergence AdminSt `json:"fastConvergence"`
7373
74- // Peer contains the vPC peer configuration including peer-link, keepalive.
74+ // Peer contains the vPCDomain peer configuration including peer-link, keepalive.
7575 // +required
7676 Peer Peer `json:"peer"`
7777}
7878
7979// AdminSt represents administrative state (enabled/disabled).
80- // Used for various vPC features.
80+ // Used for various vPCDomain features.
8181type AdminSt struct {
8282 // Enabled indicates whether the feature is administratively enabled (true) or disabled (false).
8383 // +required
8484 Enabled bool `json:"enabled"`
8585}
8686
87- // Peer defines the vPC peer configuration.
88- // Encompasses all settings related to the relationship between the two vPC peer switches.
87+ // Peer defines the vPCDomain peer configuration.
88+ // Encompasses all settings related to the relationship between the two vPCDomain peer switches.
8989type Peer struct {
9090 // InterfaceAggregateRef is a reference to an Interface resource with type `Aggregate`.
91- // This is a dedicated port-channel between the two switches, that will be configured as the vPC peer-link.
92- // and which carries control and data traffic between the two vPC peers.
93- // Maps to: "vpc peer-link" configured on the referenced port-channel interface
91+ // This is a dedicated port-channel between the two switches, that will be configured as the vPCDomain peer-link.
92+ // and which carries control and data traffic between the two vPCDomain peers.
93+ // Maps to: "vpcdomain peer-link" configured on the referenced port-channel interface
9494 // +required
9595 InterfaceAggregateRef corev1.LocalObjectReference `json:"interfaceAggregateRef,omitempty"`
9696
9797 // KeepAlive defines the out-of-band keepalive configuration.
9898 // +required
9999 KeepAlive KeepAlive `json:"keepalive"`
100100
101- // AutoRecovery defines auto-recovery settings for restoring vPC after peer failure.
101+ // AutoRecovery defines auto-recovery settings for restoring vPCDomain after peer failure.
102102 // +required
103103 AutoRecovery AutoRecovery `json:"autoRecovery"`
104104
105105 // Switch enables peer-switch functionality on this peer.
106- // When enabled, both vPC peers use the same spanning-tree bridge ID, allowing both
106+ // When enabled, both vPCDomain peers use the same spanning-tree bridge ID, allowing both
107107 // to forward traffic for all VLANs without blocking any ports.
108108 // Maps to: "peer-switch" when enabled
109109 // +required
110110 Switch AdminSt `json:"switch"`
111111
112112 // Gateway enables peer-gateway functionality on this peer.
113- // When enabled, each vPC peer can act as the active gateway for packets destined to the
113+ // When enabled, each vPCDomain peer can act as the active gateway for packets destined to the
114114 // peer's MAC address, improving convergence.
115115 // Maps to: "peer-gateway" when enabled
116116 // +required
@@ -122,11 +122,11 @@ type Peer struct {
122122 Router AdminSt `json:"router"`
123123}
124124
125- // KeepAlive defines the vPC keepalive link configuration.
125+ // KeepAlive defines the vPCDomain keepalive link configuration.
126126// The keepalive is typically a separate out-of-band link (often over mgmt0) used to monitor
127127// peer health. It does not carry data traffic.
128128type KeepAlive struct {
129- // Destination is the destination IP address of the vPC peer's keepalive interface.
129+ // Destination is the destination IP address of the vPCDomain peer's keepalive interface.
130130 // This is the IP address the local switch will send keepalive messages to.
131131 // Maps to: "peer-keepalive destination <Destination> ..."
132132 // +kubebuilder:validation:Format=ipv4
@@ -144,25 +144,25 @@ type KeepAlive struct {
144144 // If specified, the keepalive will use this VRF for routing keepalive packets.
145145 // Typically used when keepalive is over a management VRF.
146146 // Maps to: "peer-keepalive destination <Destination> source <Source> vrf <VRFRef.Name>"
147- // The VRF must exist on the Device referenced by the parent VPC resource.
147+ // The VRF must exist on the Device referenced by the parent VPCDomain resource.
148148 // If omitted, the default VRF is used.
149149 // +optional
150150 VRFRef * corev1.LocalObjectReference `json:"vrf,omitempty"`
151151}
152152
153153// AutoRecovery holds auto-recovery settings.
154- // It allows a vPC peer to automatically restore vPC operation after detecting
154+ // It allows a vPCDomain peer to automatically restore vPCDomain operation after detecting
155155// that the peer is no longer reachable via keepalive link.
156156// +kubebuilder:validation:XValidation:rule="self.enabled ? has(self.reloadDelay) : !has(self.reloadDelay)",message="reloadDelay must be set when enabled and absent when disabled"
157157type AutoRecovery struct {
158158 // Enabled indicates whether auto-recovery is enabled.
159159 // When enabled, the switch will wait for ReloadDelay seconds after peer failure
160- // before assuming the peer is dead and restoring vPC functionality.
160+ // before assuming the peer is dead and restoring vPCDomain functionality.
161161 // Maps to: "auto-recovery" being present (enabled) or absent (disabled)
162162 Enabled bool `json:"enabled,omitempty"`
163163
164164 // ReloadDelay is the time in seconds (60-3600) to wait before assuming the peer is dead
165- // and automatically recovering vPC operation.
165+ // and automatically recovering vPCDomain operation.
166166 // Must be set when Enabled is true.
167167 // Maps to: "auto-recovery reload-delay <ReloadDelay>"
168168 // +optional
@@ -171,96 +171,121 @@ type AutoRecovery struct {
171171 ReloadDelay uint32 `json:"reloadDelay,omitempty"`
172172}
173173
174- // VPCStatus defines the observed state of VPC .
175- type VPCStatus struct {
176- // Conditions represent the latest available observations of the VPC 's state.
174+ // VPCDomainStatus defines the observed state of VPCDomain .
175+ type VPCDomainStatus struct {
176+ // Conditions represent the latest available observations of the VPCDomain 's state.
177177 // Standard conditions include:
178- // - Ready: overall readiness of the vPC domain
179- // - Configured: whether the vPC configuration was successfully applied to the device
180- // - Operational: whether the vPC domain is operationally up (peer-link and keepalive status)
178+ // - Ready: overall readiness of the vPCDomain domain
179+ // - Configured: whether the vPCDomain configuration was successfully applied to the device
180+ // - Operational: whether the vPCDomain domain is operationally up (peer-link and keepalive status)
181181 //+listType=map
182182 //+listMapKey=type
183183 //+patchStrategy=merge
184184 //+patchMergeKey=type
185185 //+optional
186186 Conditions []metav1.Condition `json:"conditions,omitempty"`
187187
188- // DomainID is the vPC domain ID as reported by the device.
188+ // DomainID is the vPCDomain domain ID as reported by the device.
189189 // +optional
190190 DomainID uint16 `json:"domainId,omitempty"`
191191
192- // Role indicates the current operational role of this vPC peer.
192+ // Role indicates the current operational role of this vPCDomain peer.
193193 // Possible values:
194- // - Primary: This switch is the primary vPC peer (lower role priority or elected)
195- // - Secondary: This switch is the secondary vPC peer
194+ // - Primary: This switch is the primary vPCDomain peer (lower role priority or elected)
195+ // - Secondary: This switch is the secondary vPCDomain peer
196196 // - Unknown: Role has not been established (e.g., peer-link down, domain not formed)
197197 // +optional
198- Role VPCRole `json:"role,omitempty"`
198+ Role VPCDomainRole `json:"role,omitempty"`
199199
200- // PeerUptime indicates how long the vPC peer has been up and reachable via keepalive.
200+ // KeepaliveStatus indicates the status of the peer via the keepalive link.
201+ // +optional
202+ KeepaliveStatus KeepAliveStatus `json:"keepaliveStatus,omitempty"`
203+
204+ // PeerStatus indicates the status of the vPCDomain peer-link.
205+ // +optional
206+ PeerStatus string `json:"peerStatus,omitempty"`
207+
208+ // PeerUptime indicates how long the vPCDomain peer has been up and reachable via keepalive.
201209 // +optional
202210 PeerUptime metav1.Duration `json:"peerUptime,omitempty"`
203211}
204212
205- // The VPCRole type represents the operational role of a vPC peer as returned by the device.
206- type VPCRole string
213+ // The VPCDomainRole type represents the operational role of a vPCDomain peer as returned by the device.
214+ type VPCDomainRole string
215+
216+ const (
217+ VPCDomainRolePrimary VPCDomainRole = "Pri"
218+ VPCDomainRolePrimaryOperationalSecondary VPCDomainRole = "Pri/Sec"
219+ VPCDomainRoleSecondary VPCDomainRole = "Sec"
220+ VPCDomainRoleSecondaryOperationalPrimary VPCDomainRole = "Sec/Pri"
221+ VPCDomainRoleUnknown VPCDomainRole = "Unknown"
222+ )
223+
224+ type KeepAliveStatus string
225+
226+ const (
227+ KeepAliveStatusUp KeepAliveStatus = "Up"
228+ KeepAliveStatusDown KeepAliveStatus = "Down"
229+ )
230+
231+ type PeerStatus string
207232
208233const (
209- VPCRolePrimary VPCRole = "Pri"
210- VPCRolePrimaryOperationalSecondary VPCRole = "Pri/Sec"
211- VPCRoleSecondary VPCRole = "Sec"
212- VPCRoleSecondaryOperationalPrimary VPCRole = "Sec/Pri"
213- VPCRoleUnknown VPCRole = "Unknown"
234+ PeerStatusUp PeerStatus = "Up"
235+ PeerStatusDown PeerStatus = "Down"
236+ PeerStatusNotFormed PeerStatus = "NotFormed"
214237)
215238
216239// +kubebuilder:object:root=true
217240// +kubebuilder:subresource:status
218- // +kubebuilder:resource:path=vpcs
219- // +kubebuilder:resource:singular=vpc
220- // +kubebuilder:resource:shortName=vpc
241+ // +kubebuilder:resource:path=vpcdomains
242+ // +kubebuilder:resource:singular=vpcdomain
243+ // +kubebuilder:resource:shortName=vpcdomain
221244// +kubebuilder:printcolumn:name="Device",type=string,JSONPath=`.spec.deviceRef.name`
222245// +kubebuilder:printcolumn:name="Domain",type=string,JSONPath=`.spec.domainId`
223246// +kubebuilder:printcolumn:name="Enabled",type=string,JSONPath=`.spec.adminState`
224247// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
225248// +kubebuilder:printcolumn:name="Configured",type=string,JSONPath=`.status.conditions[?(@.type=="Configured")].status`,priority=1
226249// +kubebuilder:printcolumn:name="Operational",type=string,JSONPath=`.status.conditions[?(@.type=="Operational")].status`,priority=1
250+ // +kubebuilder:printcolumn:name="KeepAliveStatus",type=string,JSONPath=`.status.keepaliveStatus`,priority=1
251+ // +kubebuilder:printcolumn:name="PeerStatus",type=string,JSONPath=`.status.peerStatus`,priority=1
227252// +kubebuilder:printcolumn:name="Role",type=string,JSONPath=`.status.role`,priority=1
228253// +kubebuilder:printcolumn:name="PeerUptime",type="date",JSONPath=`.status.peerUptime`,priority=1
229254// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
230255
231- // VPC is the Schema for the VPCs API
232- type VPC struct {
256+ // VPCDomain is the Schema for the VPCDomains API
257+ type VPCDomain struct {
233258 metav1.TypeMeta `json:",inline"`
234259 metav1.ObjectMeta `json:"metadata,omitempty"`
235260
236- // spec defines the desired state of VPC
261+ // spec defines the desired state of VPCDomain
237262 // +required
238- Spec VPCSpec `json:"spec,omitempty"`
263+ Spec VPCDomainSpec `json:"spec,omitempty"`
239264
240- // status defines the observed state of VPC
265+ // status defines the observed state of VPCDomain
241266 // +optional
242- Status VPCStatus `json:"status,omitempty,omitzero"`
267+ Status VPCDomainStatus `json:"status,omitempty,omitzero"`
243268}
244269
245270// GetConditions implements conditions.Getter.
246- func (in * VPC ) GetConditions () []metav1.Condition {
271+ func (in * VPCDomain ) GetConditions () []metav1.Condition {
247272 return in .Status .Conditions
248273}
249274
250275// SetConditions implements conditions.Setter.
251- func (in * VPC ) SetConditions (conditions []metav1.Condition ) {
276+ func (in * VPCDomain ) SetConditions (conditions []metav1.Condition ) {
252277 in .Status .Conditions = conditions
253278}
254279
255280// +kubebuilder:object:root=true
256281
257- // VPCList contains a list of VPC
258- type VPCList struct {
282+ // VPCDomainList contains a list of VPCDomain
283+ type VPCDomainList struct {
259284 metav1.TypeMeta `json:",inline"`
260285 metav1.ListMeta `json:"metadata,omitempty"`
261- Items []VPC `json:"items"`
286+ Items []VPCDomain `json:"items"`
262287}
263288
264289func init () {
265- SchemeBuilder .Register (& VPC {}, & VPCList {})
290+ SchemeBuilder .Register (& VPCDomain {}, & VPCDomainList {})
266291}
0 commit comments