Skip to content

Commit b939d57

Browse files
Add ISIS resource and controller
1 parent b20962c commit b939d57

21 files changed

+1226
-3
lines changed

PROJECT

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,13 @@ resources:
109109
kind: ManagementAccess
110110
path: github.com/ironcore-dev/network-operator/api/v1alpha1
111111
version: v1alpha1
112+
- api:
113+
crdVersion: v1
114+
namespaced: true
115+
controller: true
116+
domain: cloud.sap
117+
group: networking
118+
kind: ISIS
119+
path: github.com/ironcore-dev/network-operator/api/v1alpha1
120+
version: v1alpha1
112121
version: "3"

Tiltfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ k8s_resource(new_name='syslog', objects=['syslog:syslog'], trigger_mode=TRIGGER_
7575
k8s_yaml('./config/samples/v1alpha1_managementaccess.yaml')
7676
k8s_resource(new_name='managementaccess', objects=['managementaccess:managementaccess'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False)
7777

78+
k8s_yaml('./config/samples/v1alpha1_isis.yaml')
79+
k8s_resource(new_name='underlay', objects=['underlay:isis'], resource_deps=['lo0', 'lo1', 'eth1-1', 'eth1-2'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False)
80+
7881
print('🚀 network-operator development environment')
7982
print('👉 Edit the code inside the api/, cmd/, or internal/ directories')
8083
print('👉 Tilt will automatically rebuild and redeploy when changes are detected')

api/v1alpha1/isis_types.go

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
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+
// ISISSpec defines the desired state of ISIS
11+
type ISISSpec struct {
12+
// DeviceName is the name of the Device this object belongs to. The Device object must exist in the same namespace.
13+
// Immutable.
14+
// +required
15+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="DeviceRef is immutable"
16+
DeviceRef LocalObjectReference `json:"deviceRef"`
17+
18+
// ProviderConfigRef is a reference to a resource holding the provider-specific configuration of this interface.
19+
// This reference is used to link the Interface to its provider-specific configuration.
20+
// +optional
21+
ProviderConfigRef *TypedLocalObjectReference `json:"providerConfigRef,omitempty"`
22+
23+
// Instance is the name of the ISIS instance.
24+
// +required
25+
// +kubebuilder:validation:MinLength=1
26+
// +kubebuilder:validation:MaxLength=63
27+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Instance is immutable"
28+
Instance string `json:"instance"`
29+
30+
// NetworkEntityTitle is the NET of the ISIS instance.
31+
// +required
32+
// +kubebuilder:validation:Pattern=`^[a-fA-F0-9]{2}(\.[a-fA-F0-9]{4}){3,9}\.[a-fA-F0-9]{2}$`
33+
NetworkEntityTitle string `json:"networkEntityTitle"`
34+
35+
// Type indicates the level of the ISIS instance.
36+
// +required
37+
Type ISISLevel `json:"type"`
38+
39+
// OverloadBit indicates the overload bit of the ISIS instance.
40+
// +optional
41+
// +kubebuilder:default=Never
42+
OverloadBit OverloadBit `json:"overloadBit,omitempty"`
43+
44+
// AddressFamilies is a list of address families for the ISIS instance.
45+
// +required
46+
// +listType=set
47+
// +kubebuilder:validation:MinItems=1
48+
// +kubebuilder:validation:MaxItems=2
49+
AddressFamilies []AddressFamily `json:"addressFamilies"`
50+
51+
// Interfaces is a list of interfaces that are part of the ISIS instance.
52+
// +optional
53+
// +listType=atomic
54+
Interfaces []ISISInterface `json:"interfaces,omitempty"`
55+
}
56+
57+
// ISISLevel represents the level of an ISIS instance.
58+
// +kubebuilder:validation:Enum=Level1;Level2;Level1-2
59+
type ISISLevel string
60+
61+
const (
62+
ISISLevel1 ISISLevel = "Level1"
63+
ISISLevel2 ISISLevel = "Level2"
64+
ISISLevel12 ISISLevel = "Level1-2"
65+
)
66+
67+
// OverloadBit represents the overload bit of an ISIS instance.
68+
// +kubebuilder:validation:Enum=Always;Never;OnStartup
69+
type OverloadBit string
70+
71+
const (
72+
OverloadBitAlways OverloadBit = "Always"
73+
OverloadBitNever OverloadBit = "Never"
74+
OverloadBitOnStartup OverloadBit = "OnStartup"
75+
)
76+
77+
// AddressFamily represents the address family of an ISIS instance.
78+
// +kubebuilder:validation:Enum=IPv4Unicast;IPv6Unicast
79+
type AddressFamily string
80+
81+
const (
82+
AddressFamilyIPv4Unicast AddressFamily = "IPv4Unicast"
83+
AddressFamilyIPv6Unicast AddressFamily = "IPv6Unicast"
84+
)
85+
86+
type ISISInterface struct {
87+
// Ref is a reference to the interface object.
88+
// The interface object must exist in the same namespace.
89+
// +required
90+
Ref LocalObjectReference `json:"ref"`
91+
92+
// BFD contains BFD configuration for the interface.
93+
// +optional
94+
// +kubebuilder:default={}
95+
BFD ISISBFD `json:"bfd,omitzero"`
96+
}
97+
98+
type ISISBFD struct {
99+
// Enabled indicates whether BFD is enabled on the interface.
100+
// +optional
101+
// +kubebuilder:default=false
102+
Enabled bool `json:"enabled"`
103+
}
104+
105+
// ISISStatus defines the observed state of ISIS.
106+
type ISISStatus struct {
107+
// The conditions are a list of status objects that describe the state of the ISIS.
108+
//+listType=map
109+
//+listMapKey=type
110+
//+patchStrategy=merge
111+
//+patchMergeKey=type
112+
//+optional
113+
Conditions []metav1.Condition `json:"conditions,omitempty"`
114+
}
115+
116+
// +kubebuilder:object:root=true
117+
// +kubebuilder:subresource:status
118+
// +kubebuilder:resource:path=isis
119+
// +kubebuilder:printcolumn:name="Device",type=string,JSONPath=`.spec.deviceRef.name`
120+
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
121+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
122+
123+
// ISIS is the Schema for the isis API
124+
type ISIS struct {
125+
metav1.TypeMeta `json:",inline"`
126+
metav1.ObjectMeta `json:"metadata,omitempty"`
127+
128+
// Specification of the desired state of the resource.
129+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
130+
// +required
131+
Spec ISISSpec `json:"spec,omitempty"`
132+
133+
// Status of the resource. This is set and updated automatically.
134+
// Read-only.
135+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
136+
// +optional
137+
Status ISISStatus `json:"status,omitempty,omitzero"`
138+
}
139+
140+
// +kubebuilder:object:root=true
141+
142+
// ISISList contains a list of ISIS
143+
type ISISList struct {
144+
metav1.TypeMeta `json:",inline"`
145+
metav1.ListMeta `json:"metadata,omitempty"`
146+
Items []ISIS `json:"items"`
147+
}
148+
149+
func init() {
150+
SchemeBuilder.Register(&ISIS{}, &ISISList{})
151+
}

api/v1alpha1/zz_generated.deepcopy.go

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

cmd/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,17 @@ func main() {
325325
setupLog.Error(err, "unable to create controller", "controller", "ManagementAccess")
326326
os.Exit(1)
327327
}
328+
329+
if err := (&controller.ISISReconciler{
330+
Client: mgr.GetClient(),
331+
Scheme: mgr.GetScheme(),
332+
Recorder: mgr.GetEventRecorderFor("isis-controller"),
333+
WatchFilterValue: watchFilterValue,
334+
Provider: prov,
335+
}).SetupWithManager(mgr); err != nil {
336+
setupLog.Error(err, "unable to create controller", "controller", "ISIS")
337+
os.Exit(1)
338+
}
328339
// +kubebuilder:scaffold:builder
329340

330341
if metricsCertWatcher != nil {

0 commit comments

Comments
 (0)