|
| 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 | + v1alpha1 "github.com/ironcore-dev/network-operator/api/core/v1alpha1" |
| 10 | +) |
| 11 | + |
| 12 | +// +kubebuilder:rbac:groups=nx.cisco.networking.metal.ironcore.dev,resources=portchannelconfigs,verbs=get;list;watch |
| 13 | + |
| 14 | +// PortChannelConfig defines the desired state of a PortChannel. |
| 15 | +// Use as provider specific resource for core resources of type `Interface` (sub-type `Aggregate`). |
| 16 | +type PortChannelConfigSpec struct { |
| 17 | + // VPCPeerLink indicates whether this PortChannel is part of the vPC peer link. |
| 18 | + // +optional |
| 19 | + // +kubebuilder:default=false |
| 20 | + VPCPeerLink bool `json:"vpcPeerLink,omitempty"` |
| 21 | +} |
| 22 | + |
| 23 | +// +kubebuilder:object:root=true |
| 24 | +// +kubebuilder:resource:path=portchannelconfigs |
| 25 | +// +kubebuilder:resource:singular=portchannelconfig |
| 26 | +// +kubebuilder:resource:shortName=pccfg |
| 27 | + |
| 28 | +// PortChannelConfig is the Schema for the NVE API |
| 29 | +type PortChannelConfig struct { |
| 30 | + metav1.TypeMeta `json:",inline"` |
| 31 | + metav1.ObjectMeta `json:"metadata,omitempty,omitzero"` |
| 32 | + |
| 33 | + // spec defines the desired state of NVE |
| 34 | + // +required |
| 35 | + Spec PortChannelConfigSpec `json:"spec"` |
| 36 | +} |
| 37 | + |
| 38 | +// +kubebuilder:object:root=true |
| 39 | + |
| 40 | +// NVEList contains a list of NVE |
| 41 | +type PortChannelConfigList struct { |
| 42 | + metav1.TypeMeta `json:",inline"` |
| 43 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 44 | + Items []PortChannelConfig `json:"items"` |
| 45 | +} |
| 46 | + |
| 47 | +// init registers the PortChannelConfig type with the core v1alpha1 scheme and sets |
| 48 | +// itself as a dependency for the NVE core type. |
| 49 | +func init() { |
| 50 | + v1alpha1.RegisterInterfaceDependency(v1alpha1.InterfaceTypeAggregate, GroupVersion.WithKind("PortChannelConfig")) |
| 51 | + SchemeBuilder.Register(&PortChannelConfig{}, &PortChannelConfigList{}) |
| 52 | +} |
0 commit comments