Skip to content

Commit 589e860

Browse files
Standardize administrative state using AdminState enum across resources
This patch harmonizes the API for setting a administrative state on resources using the AdminState enumeration and introduces this field for protocols (BGP, OSPF, ISIS, PIM) and system level services (NTP, DNS).
1 parent 2b21559 commit 589e860

39 files changed

+264
-32
lines changed

api/cisco/nx/v1alpha1/bordergateway_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ type BorderGatewaySpec struct {
1717
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="DeviceRef is immutable"
1818
DeviceRef v1alpha1.LocalObjectReference `json:"deviceRef"`
1919

20+
// AdminState indicates whether the BorderGateway instance is administratively up or down.
21+
// +optional
22+
// +kubebuilder:default=Up
23+
AdminState v1alpha1.AdminState `json:"adminState,omitempty"`
24+
2025
// MultisiteID is the identifier for the multisite border gateway.
2126
// +required
2227
// +kubebuilder:validation:Minimum=1

api/core/v1alpha1/bgp_peer_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ type BGPPeerSpec struct {
2121
// +optional
2222
ProviderConfigRef *TypedLocalObjectReference `json:"providerConfigRef,omitempty"`
2323

24+
// AdminState indicates whether this BGP peer is administratively up or down.
25+
// When Down, the BGP session with this peer is administratively shut down.
26+
// +optional
27+
// +kubebuilder:default=Up
28+
AdminState AdminState `json:"adminState,omitempty"`
29+
2430
// Address is the IPv4 address of the BGP peer.
2531
// +required
2632
// +kubebuilder:validation:Format=ipv4

api/core/v1alpha1/bgp_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ type BGPSpec struct {
2121
// +optional
2222
ProviderConfigRef *TypedLocalObjectReference `json:"providerConfigRef,omitempty"`
2323

24+
// AdminState indicates whether this BGP router is administratively up or down.
25+
// +optional
26+
// +kubebuilder:default=Up
27+
AdminState AdminState `json:"adminState,omitempty"`
28+
2429
// ASNumber is the autonomous system number (ASN) for the BGP router.
2530
// Supports both plain format (1-4294967295) and dotted notation (1-65535.0-65535) as per RFC 5396.
2631
// +required

api/core/v1alpha1/dns_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ type DNSSpec struct {
2020
// +optional
2121
ProviderConfigRef *TypedLocalObjectReference `json:"providerConfigRef,omitempty"`
2222

23+
// AdminState indicates whether DNS is administratively up or down.
24+
// +optional
25+
// +kubebuilder:default=Up
26+
AdminState AdminState `json:"adminState,omitempty"`
27+
2328
// Default domain name that the device uses to complete unqualified hostnames.
2429
// +required
2530
// +kubebuilder:validation:MinLength=1

api/core/v1alpha1/interface_types.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,16 @@ type InterfaceSpec struct {
9595
BFD *BFD `json:"bfd,omitempty"`
9696
}
9797

98-
// AdminState represents the administrative state of the interface.
98+
// AdminState represents the administrative state of a resource.
99+
// This type is used across multiple resources including interfaces, protocols (BGP, OSPF, ISIS, PIM),
100+
// and system services (NTP, DNS) to indicate whether these are administratively enabled or disabled.
99101
// +kubebuilder:validation:Enum=Up;Down
100102
type AdminState string
101103

102104
const (
103-
// AdminStateUp indicates that the interface is administratively set up.
105+
// AdminStateUp indicates that the resource is administratively enabled.
104106
AdminStateUp AdminState = "Up"
105-
// AdminStateDown indicates that the interface is administratively set down.
107+
// AdminStateDown indicates that the resource is administratively disabled.
106108
AdminStateDown AdminState = "Down"
107109
)
108110

api/core/v1alpha1/isis_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ type ISISSpec struct {
2020
// +optional
2121
ProviderConfigRef *TypedLocalObjectReference `json:"providerConfigRef,omitempty"`
2222

23+
// AdminState indicates whether the ISIS instance is administratively up or down.
24+
// +optional
25+
// +kubebuilder:default=Up
26+
AdminState AdminState `json:"adminState,omitempty"`
27+
2328
// Instance is the name of the ISIS instance.
2429
// +required
2530
// +kubebuilder:validation:MinLength=1

api/core/v1alpha1/ntp_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ type NTPSpec struct {
2020
// +optional
2121
ProviderConfigRef *TypedLocalObjectReference `json:"providerConfigRef,omitempty"`
2222

23+
// AdminState indicates whether NTP is administratively up or down.
24+
// +optional
25+
// +kubebuilder:default=Up
26+
AdminState AdminState `json:"adminState,omitempty"`
27+
2328
// Source interface for all NTP traffic.
2429
// +required
2530
// +kubebuilder:validation:MinLength=1

api/core/v1alpha1/ospf_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ type OSPFSpec struct {
2020
// +optional
2121
ProviderConfigRef *TypedLocalObjectReference `json:"providerConfigRef,omitempty"`
2222

23+
// AdminState indicates whether the OSPF instance is administratively up or down.
24+
// +optional
25+
// +kubebuilder:default=Up
26+
AdminState AdminState `json:"adminState,omitempty"`
27+
2328
// Instance is the process tag of the OSPF instance.
2429
// +required
2530
// +kubebuilder:validation:MinLength=1

api/core/v1alpha1/pim_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ type PIMSpec struct {
2020
// +optional
2121
ProviderConfigRef *TypedLocalObjectReference `json:"providerConfigRef,omitempty"`
2222

23+
// AdminState indicates whether the PIM instance is administratively up or down.
24+
// +optional
25+
// +kubebuilder:default=Up
26+
AdminState AdminState `json:"adminState,omitempty"`
27+
2328
// RendezvousPoints defines the list of rendezvous points for sparse mode multicast.
2429
// +optional
2530
// +listType=map

api/core/v1alpha1/ref_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
22
// SPDX-License-Identifier: Apache-2.0
3+
34
package v1alpha1
45

56
// LocalObjectReference contains enough information to locate a

0 commit comments

Comments
 (0)