You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(controller): add support for L3 subinterfaces
Implement basic CRUD operations for SubInterfaces:
* Validate that the parent interface exists and is in a configured state before applying subinterface;
halt reconciliation otherwise
* Ensure parent interface is Layer 3 (no switchport configuration)
* Watch parent interface for create/update events to trigger reconciliation when it becomes available
* Cascade deletion: removing the parent interface also deletes associated subinterfaces
To support the cascading deletion of interfaces, we set owner reference on subinterface to parent
interface. Omitting device owner reference on subinterface as this
blocks deletion until device gets deleted.
Message: fmt.Sprintf("referenced parent interface %q for not found", key),
811
+
})
812
+
returnreconcile.TerminalError(fmt.Errorf("failed to get parent interface %q: %w", s.Interface.Spec.ParentInterfaceRef.Name, err))
813
+
}
814
+
returnerr
815
+
}
816
+
817
+
// Check matching device reference
818
+
ifparentIntf.Spec.DeviceRef.Name!=s.Device.Name {
819
+
conditions.Set(s.Interface, metav1.Condition{
820
+
Type: v1alpha1.ConfiguredCondition,
821
+
Status: metav1.ConditionFalse,
822
+
Reason: v1alpha1.CrossDeviceReferenceReason,
823
+
Message: fmt.Sprintf("parent interface %q belongs to a different device", key),
824
+
})
825
+
returnreconcile.TerminalError(fmt.Errorf("parent interface %q belongs to device %q in not ready state", s.Interface.Spec.ParentInterfaceRef.Name, parentIntf.Spec.DeviceRef.Name))
826
+
}
827
+
828
+
// Check if parent interface is an aggregate or physical interface
Message: fmt.Sprintf("parent interface %q is not of type Physical or Aggregate, got %q", key, parentIntf.Spec.Type),
835
+
})
836
+
returnreconcile.TerminalError(fmt.Errorf("parent interface %q is not of type Physical or Aggregate, got %q", s.Interface.Spec.ParentInterfaceRef.Name, parentIntf.Spec.Type))
837
+
}
838
+
839
+
// L2 interfaces do not support subinterfaces config
840
+
ifparentIntf.Spec.Switchport!=nil {
841
+
conditions.Set(s.Interface, metav1.Condition{
842
+
Type: v1alpha1.ConfiguredCondition,
843
+
Status: metav1.ConditionFalse,
844
+
Reason: v1alpha1.InvalidInterfaceTypeReason,
845
+
Message: fmt.Sprintf("parent interface %q is an L2 interface", key),
846
+
})
847
+
returnreconcile.TerminalError(fmt.Errorf("parent interface %q is an L2 interface", s.Interface.Spec.ParentInterfaceRef.Name))
848
+
}
849
+
850
+
// Ensure the Subinterface is owned by the parent interface.
0 commit comments