Skip to content

Commit 17c584e

Browse files
Set suppress-ra and ra-interval
Signed-off-by: Oliver Frommel <oliver.frommel@bwi.de>
1 parent 05a059a commit 17c584e

22 files changed

Lines changed: 1074 additions & 1 deletion

‎.typos.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ specifc = "specifc"
2121
cpy = "cpy"
2222
# The Kubernetes built-in matchExpressions field uses the word "ANDed" in its documentation.
2323
ded = "ded"
24+
# The NX-OS CLI keyword for Neighbor Discovery, as in "ipv6 nd suppress-ra".
25+
nd = "nd"
2426

2527
[files]
2628
extend-exclude = [

‎Tiltfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ k8s_resource(new_name='vpcdomain', objects=['leaf1-vpcdomain:vpcdomain', 'leaf1-
170170
k8s_yaml('./config/samples/cisco/nx/v1alpha1_interfaceconfig.yaml')
171171
k8s_resource(new_name='spanning-tree-network', objects=['spanning-tree-network:interfaceconfig'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False, labels=['samples'])
172172
k8s_resource(new_name='lacp-vpc', objects=['lacp-vpc:interfaceconfig'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False, labels=['samples'])
173+
k8s_resource(new_name='unnumbered-uplink', objects=['unnumbered-uplink:interfaceconfig'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False, labels=['samples'])
173174

174175
k8s_yaml('./config/samples/v1alpha1_nve.yaml')
175176
k8s_resource(new_name='nve1', objects=['nve1:networkvirtualizationedge'], trigger_mode=TRIGGER_MODE_MANUAL, resource_deps=['lo0', 'lo1'], auto_init=False, labels=['samples'])

‎api/cisco/nx/v1alpha1/interfaceconfig_types.go‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,39 @@ type InterfaceConfigSpec struct {
3030
// EVPNMultihoming defines EVPN ESI multihoming settings for the interface.
3131
// +optional
3232
EVPNMultihoming *EVPNMultihoming `json:"evpnMultihoming,omitempty"`
33+
34+
// IPv6 defines IPv6 settings for the interface that have no equivalent in
35+
// the core Interface API. Neighbor Discovery is managed on every interface
36+
// that carries IPv6 configuration: settings left out here, and every setting
37+
// of an interface without this field, are reset to the platform default.
38+
// +optional
39+
IPv6 *InterfaceConfigIPv6 `json:"ipv6,omitempty"`
40+
}
41+
42+
// InterfaceConfigIPv6 defines IPv6 settings for an interface.
43+
type InterfaceConfigIPv6 struct {
44+
// SuppressRouterAdvertisement stops the interface from sending IPv6 Router
45+
// Advertisements. NX-OS sends them by default. Neighbours that discover
46+
// each other over their link-local addresses, such as unnumbered BGP peers,
47+
// depend on them, so this must stay disabled for such interfaces.
48+
// Only applied to interfaces that carry IPv6 configuration.
49+
// Maps to CLI command: ipv6 nd suppress-ra
50+
// +optional
51+
// +kubebuilder:default=false
52+
SuppressRouterAdvertisement bool `json:"suppressRouterAdvertisement,omitempty"`
53+
54+
// RouterAdvertisementInterval is the maximum interval between periodic
55+
// IPv6 Router Advertisements, between 4s and 30m in whole seconds. The
56+
// minimum interval is derived from it the way NX-OS does for the CLI
57+
// command: a third of this value, but no less than 3s.
58+
// Unnumbered BGP peers only discover each other once an advertisement is
59+
// received, so a short interval speeds up session establishment.
60+
// If not specified, the interface is reset to the NX-OS default of 600s.
61+
// Maps to CLI command: ipv6 nd ra-interval
62+
// +optional
63+
// +kubebuilder:validation:Type=string
64+
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
65+
RouterAdvertisementInterval *metav1.Duration `json:"routerAdvertisementInterval,omitempty"`
3366
}
3467

3568
// SpanningTree defines the spanning tree configuration for an interface.

‎api/cisco/nx/v1alpha1/zz_generated.deepcopy.go‎

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

‎charts/network-operator/templates/crd/interfaceconfigs.nx.cisco.networking.metal.ironcore.dev.yaml‎

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

‎config/crd/bases/nx.cisco.networking.metal.ironcore.dev_interfaceconfigs.yaml‎

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

‎config/samples/cisco/nx/v1alpha1_interfaceconfig.yaml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,18 @@ metadata:
3131
spec:
3232
evpnMultihoming:
3333
coreTracking: true
34+
---
35+
apiVersion: nx.cisco.networking.metal.ironcore.dev/v1alpha1
36+
kind: InterfaceConfig
37+
metadata:
38+
labels:
39+
app.kubernetes.io/name: network-operator
40+
app.kubernetes.io/managed-by: kustomize
41+
name: unnumbered-uplink
42+
spec:
43+
# Peers discover each other through Router Advertisements sent to their
44+
# link-local addresses, so advertisements must not be suppressed. A short
45+
# interval lets the session come up within seconds rather than minutes.
46+
ipv6:
47+
suppressRouterAdvertisement: false
48+
routerAdvertisementInterval: 4s

‎config/samples/v1alpha1_interface.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,12 @@ spec:
277277
adminState: Up
278278
type: Physical
279279
mtu: 9216
280+
# Router Advertisement settings have no equivalent in the core API. On NX-OS
281+
# they come from an InterfaceConfig, referenced like this:
282+
# providerConfigRef:
283+
# apiVersion: nx.cisco.networking.metal.ironcore.dev/v1alpha1
284+
# kind: InterfaceConfig
285+
# name: unnumbered-uplink
280286
# Use only the automatically generated IPv6 link-local address, so the link
281287
# needs no addressing of its own. Mutually exclusive with ipv6.addresses.
282288
ipv6:

‎docs/api-reference/index.md‎

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

‎hack/provider/main.go‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"syscall"
1818

1919
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
20+
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2021
"k8s.io/apimachinery/pkg/runtime"
2122
"k8s.io/apimachinery/pkg/runtime/serializer"
2223
"k8s.io/client-go/kubernetes/scheme"
@@ -151,7 +152,17 @@ func loadAndUnmarshalResource(path string) (runtime.Object, error) {
151152

152153
obj, _, err := decoder.Decode(json, nil, nil)
153154
if err != nil {
154-
return nil, fmt.Errorf("failed to decode resource: %w", err)
155+
if !runtime.IsNotRegisteredError(err) {
156+
return nil, fmt.Errorf("failed to decode resource: %w", err)
157+
}
158+
// Provider-specific configs live in their own API groups and are read
159+
// as unstructured objects by the providers, so decode them as such
160+
// instead of registering every group in the scheme.
161+
u := &unstructured.Unstructured{}
162+
if err := u.UnmarshalJSON(json); err != nil {
163+
return nil, fmt.Errorf("failed to decode resource: %w", err)
164+
}
165+
return u, nil
155166
}
156167

157168
return obj, nil

0 commit comments

Comments
 (0)