Skip to content

Commit 80f07c3

Browse files
pbasovbnallapeta
authored andcommitted
Add trunk subports support for OpenStackMachine ports
1 parent b9fa78b commit 80f07c3

38 files changed

+6439
-604
lines changed

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/types.go

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ type AllocationPool struct {
290290
End string `json:"end"`
291291
}
292292

293-
type PortOpts struct {
293+
type CommonPortOpts struct {
294294
// Network is a query for an openstack network that the port will be created or discovered on.
295295
// This will fail if the query returns more than one network.
296296
// +optional
@@ -320,13 +320,41 @@ type PortOpts struct {
320320
// +optional
321321
Tags []string `json:"tags,omitempty"`
322322

323+
ResolvedPortSpecFields `json:",inline"`
324+
}
325+
326+
// PortOpts defines port parameters.
327+
type PortOpts struct {
323328
// Trunk specifies whether trunking is enabled at the port level. If not
324329
// provided the value is inherited from the machine, or false for a
325330
// bastion host.
326331
// +optional
327332
Trunk *bool `json:"trunk,omitempty"`
328333

329-
ResolvedPortSpecFields `json:",inline"`
334+
// Subports is a list of port specifications that will be created as
335+
// subports of the trunk.
336+
// +optional
337+
// +listType=atomic
338+
Subports []SubportOpts `json:"subports,omitempty"`
339+
340+
CommonPortOpts `json:",inline"`
341+
}
342+
343+
// SubportOpts defines a trunk subport.
344+
type SubportOpts struct {
345+
// SegmentationID is the segmentation ID of the subport. E.g. VLAN ID.
346+
// +required
347+
// +kubebuilder:validation:Minimum:=1
348+
// +kubebuilder:validation:Maximum:=4094
349+
SegmentationID int `json:"segmentationID"`
350+
351+
// SegmentationType is the segmentation type of the subport. E.g. "vlan".
352+
// +required
353+
// +kubebuilder:validation:Enum=vlan;flat
354+
SegmentationType string `json:"segmentationType"`
355+
356+
// Port contains parameters of the port associated with this subport
357+
CommonPortOpts `json:",inline"`
330358
}
331359

332360
// ResolvePortSpecFields is a convenience struct containing all fields of a
@@ -393,7 +421,7 @@ type ResolvedPortSpecFields struct {
393421
}
394422

395423
// ResolvedPortSpec is a PortOpts with all contained references fully resolved.
396-
type ResolvedPortSpec struct {
424+
type CommonResolvedPortSpec struct {
397425
// Name is the name of the port.
398426
Name string `json:"name"`
399427

@@ -408,10 +436,6 @@ type ResolvedPortSpec struct {
408436
// +optional
409437
Tags []string `json:"tags,omitempty"`
410438

411-
// Trunk specifies whether trunking is enabled at the port level.
412-
// +optional
413-
Trunk optional.Bool `json:"trunk,omitempty"`
414-
415439
// FixedIPs is a list of pairs of subnet and/or IP address to assign to the port. If specified, these must be subnets of the port's network.
416440
// +optional
417441
// +listType=atomic
@@ -425,10 +449,47 @@ type ResolvedPortSpec struct {
425449
ResolvedPortSpecFields `json:",inline"`
426450
}
427451

452+
type ResolvedPortSpec struct {
453+
// Trunk specifies whether trunking is enabled at the port level.
454+
// +optional
455+
Trunk optional.Bool `json:"trunk,omitempty"`
456+
457+
// Subports is a list of resolved port specifications that will be created as
458+
// subports of the trunk.
459+
// +optional
460+
// +listType=atomic
461+
Subports []ResolvedSubportSpec `json:"subports,omitempty"`
462+
463+
CommonResolvedPortSpec `json:",inline"`
464+
}
465+
466+
// ResolvedSubportSpec is a SubportOpts with all contained references fully resolved.
467+
type ResolvedSubportSpec struct {
468+
// SegmentationID is the segmentation ID of the subport. E.g. VLAN ID.
469+
SegmentationID int `json:"segmentationID"`
470+
471+
// SegmentationType is the segmentation type of the subport. E.g. "vlan".
472+
SegmentationType string `json:"segmentationType"`
473+
474+
// Port is a PortOpts with all contained references fully resolved. This is
475+
// essentially port which is used as subport in trunk
476+
CommonResolvedPortSpec `json:",inline"`
477+
}
478+
428479
type PortStatus struct {
429480
// ID is the unique identifier of the port.
430481
// +required
431482
ID string `json:"id"`
483+
484+
// Subports is the list of port IDs which intended to be trunk sub-ports
485+
// +optional
486+
Subports []SubPortStatus `json:"subports,omitempty"`
487+
}
488+
489+
type SubPortStatus struct {
490+
// ID is the unique identifier of the trunk sub-port.
491+
// +required
492+
ID string `json:"id"`
432493
}
433494

434495
type BindingProfile struct {

api/v1beta1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)