Skip to content

Commit 271fd37

Browse files
committed
rfc: IGP resource, controller, and provider
Add a Custom Resource for Interior Gateway Protocol (IGP) spec. While we plan support for ISIS and OSPF, we consider only ISIS here. We also include a `cisco-nxos-gnmi` provider with an `isis` pkg to configure ISIS over gNMI using ygot objects from openconfig. This provider does not implement yet the `interface` resource. Both the resource and the provider implementation DO NOT support multiple IGP processes on the same device. wip
1 parent fac47c3 commit 271fd37

30 files changed

+1539
-216
lines changed

Tiltfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ k8s_resource(new_name='eth1-1', objects=['eth1-1:interface'], trigger_mode=TRIGG
3737
k8s_resource(new_name='eth1-2', objects=['eth1-2:interface'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False)
3838
k8s_resource(new_name='eth1-10', objects=['eth1-10:interface'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False)
3939

40+
k8s_yaml('./config/samples/v1alpha1_igp.yaml')
41+
k8s_resource(new_name='leaf1-underlay-isis', objects=['leaf1-underlay-isis:igp'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False)
42+
4043
print('🚀 network-operator development environment')
4144
print('👉 Edit the code inside the api/, cmd/, or internal/ directories')
4245
print('👉 Tilt will automatically rebuild and redeploy when changes are detected')

api/v1alpha1/igp_types.go

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package v1alpha1
5+
6+
import (
7+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8+
)
9+
10+
// +kubebuilder:validation:Enum=isis
11+
type IGPType string
12+
13+
// +kubebuilder:object:root=true
14+
// +kubebuilder:subresource:status
15+
// +kubebuilder:resource:path=igps
16+
// +kubebuilder:resource:singular=igp
17+
// +kubebuilder:resource:shortName=igp
18+
// +kubebuilder:printcolumn:name="Process name",type=string,JSONPath=`.spec.name`
19+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
20+
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
21+
22+
// IGP is the Schema for the igp API.
23+
type IGP struct {
24+
metav1.TypeMeta `json:",inline"`
25+
metav1.ObjectMeta `json:"metadata,omitempty"`
26+
27+
// Specification of the desired state of the resource.
28+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
29+
Spec IGPSpec `json:"spec,omitempty"`
30+
31+
// Status of the resource. This is set and updated automatically.
32+
// Read-only.
33+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
34+
Status IGPStatus `json:"status,omitempty"`
35+
}
36+
37+
// IGProcessSpec defines the desired state of Interior Gateway Protocol (IGP) process on a device.
38+
type IGPSpec struct {
39+
// The name of the routing instance.
40+
//+kubebuilder:validation:Required
41+
Name string `json:"name"`
42+
//+kubebuilder:validation:Required
43+
ISIS ISISSpec `json:"isis,omitempty"`
44+
}
45+
46+
// IGPStatus defines the observed state of an IGP process.
47+
type IGPStatus struct {
48+
// The conditions are a list of status objects that describe the state of the Interface.
49+
//+listType=map
50+
//+listMapKey=type
51+
//+patchStrategy=merge
52+
//+patchMergeKey=type
53+
//+optional
54+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
55+
}
56+
57+
// +kubebuilder:object:root=true
58+
59+
// IGPList contains a list of IGP (processes).
60+
type IGPList struct {
61+
metav1.TypeMeta `json:",inline"`
62+
metav1.ListMeta `json:"metadata,omitempty"`
63+
Items []IGP `json:"items"`
64+
}
65+
66+
// +kubebuilder:validation:Enum=Level1;Level2;Level12
67+
type ISISLevel string
68+
69+
const (
70+
Level1 ISISLevel = "Level1"
71+
Level2 ISISLevel = "Level2"
72+
Level12 ISISLevel = "Level12"
73+
)
74+
75+
// +kubebuilder:validation:Enum=v4-unicast;v6-unicast
76+
type ISISAF string
77+
78+
const (
79+
IPv4Unicast ISISAF = "v4-unicast"
80+
IPv6Unicast ISISAF = "v6-unicast"
81+
)
82+
83+
type ISISSpec struct {
84+
// The Network Entity Title (NET) for the ISIS instance.
85+
//+kubebuilder:validation:Required
86+
NET string `json:"net"`
87+
// The is-type of the process (the level)
88+
//+kubebuilder:validation:Required
89+
Level ISISLevel `json:"level"`
90+
// Overload bit configuration for this ISIS instance
91+
//+kubebuilder:validation:Optional
92+
OverloadBit *OverloadBit `json:"overloadBit"`
93+
//+kubebuilder:validation:Required
94+
//+kubebuilder:validation:MinItems=1
95+
//+kubebuilder:validation:MaxItems=2
96+
AddressFamilies []ISISAF `json:"addressFamilies,omitempty"`
97+
}
98+
99+
type OverloadBit struct {
100+
// Duration of the OverloadBit in seconds.
101+
//+kubebuilder:validation:Required
102+
//+kubebuilder:validation:Minimum=576
103+
//+kubebuilder:validation:Maximum=86400
104+
OnStartup uint32 `json:"onStartup"`
105+
}
106+
107+
func init() {
108+
SchemeBuilder.Register(&IGP{}, &IGPList{})
109+
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 137 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)