-
Notifications
You must be signed in to change notification settings - Fork 8
Add PIM logNeighborChanges field #552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and IronCore contributors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/apimachinery/pkg/runtime" | ||
|
|
||
| v1alpha1 "github.com/ironcore-dev/network-operator/api/core/v1alpha1" | ||
| ) | ||
|
|
||
| // +kubebuilder:rbac:groups=nx.cisco.networking.metal.ironcore.dev,resources=pimconfigs,verbs=get;list;watch | ||
|
|
||
| // PIMConfigSpec defines the Cisco NX-OS specific PIM configuration. | ||
| type PIMConfigSpec struct { | ||
| // LogNeighborChanges enables logging when a PIM neighbor is added or removed. | ||
| // +optional | ||
| LogNeighborChanges *bool `json:"logNeighborChanges,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:resource:path=pimconfigs | ||
| // +kubebuilder:resource:singular=pimconfig | ||
|
|
||
| // PIMConfig is the Schema for the PIMConfig API | ||
| type PIMConfig struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty,omitzero"` | ||
|
|
||
| // spec defines the desired state of PIMConfig | ||
| // +required | ||
| Spec PIMConfigSpec `json:"spec"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // PIMConfigList contains a list of PIMConfigs | ||
| type PIMConfigList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []PIMConfig `json:"items"` | ||
| } | ||
|
|
||
| // init registers the PIMConfig type with the scheme and sets | ||
| // itself as a dependency for the PIM core type. | ||
| func init() { | ||
| v1alpha1.RegisterPIMDependency(GroupVersion.WithKind("PIMConfig")) | ||
| SchemeBuilder.Register(func(s *runtime.Scheme) error { | ||
| s.AddKnownTypes(GroupVersion, &PIMConfig{}, &PIMConfigList{}) | ||
| return nil | ||
| }) | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: nx.cisco.networking.metal.ironcore.dev/v1alpha1 | ||
| kind: PIMConfig | ||
| metadata: | ||
| labels: | ||
| app.kubernetes.io/name: network-operator | ||
| app.kubernetes.io/managed-by: kustomize | ||
| name: leaf1-pimconfig | ||
| spec: | ||
| logNeighborChanges: true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2429,6 +2429,13 @@ func (p *Provider) EnsurePIM(ctx context.Context, req *provider.EnsurePIMRequest | |||||||||||
| f.AdminSt = AdminStEnabled | ||||||||||||
| sb.Update(f) | ||||||||||||
|
|
||||||||||||
| var cfg nxv1alpha1.PIMConfig | ||||||||||||
| if req.ProviderConfig != nil { | ||||||||||||
| if err := req.ProviderConfig.Into(&cfg); err != nil { | ||||||||||||
| return err | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| pim := new(PIM) | ||||||||||||
| pim.AdminSt = AdminStEnabled | ||||||||||||
| pim.InstItems.AdminSt = AdminStEnabled | ||||||||||||
|
|
@@ -2444,6 +2451,7 @@ func (p *Provider) EnsurePIM(ctx context.Context, req *provider.EnsurePIMRequest | |||||||||||
| if req.PIM.Spec.AdminState == v1alpha1.AdminStateDown { | ||||||||||||
| dom.AdminSt = AdminStDisabled | ||||||||||||
| } | ||||||||||||
| dom.LogNbhChng = cfg.Spec.LogNeighborChanges | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| sb.Patch(dom) | ||||||||||||
|
|
||||||||||||
| rpItems := new(StaticRPItems) | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "pim-items": { | ||
| "inst-items": { | ||
| "dom-items": { | ||
| "Dom-list": [ | ||
| { | ||
| "name": "default", | ||
| "adminSt": "enabled", | ||
| "logNbhChng": true | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ip pim log-neighbor-changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field seems to always be present, with a default value of
false.Also, please pay special attention when using "omitempty". ref/ https://github.com/ironcore-dev/network-operator/blob/main/AGENTS.md?plain=1#L148-L164