Skip to content

Commit c2eba8d

Browse files
committed
Enable setting QoSPolicy on ports
Enable users to set QoSPolicyID on ports. This can be done by either defining the ID or a filter to query the QoS Policy
1 parent cb572a9 commit c2eba8d

24 files changed

+1428
-1
lines changed

api/v1beta1/types.go

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

293+
// QoSPolicyParam specifies an OpenStack QoS Policy to use. It requires the neutron qos extension to be enabled.
294+
// It may be specified by either ID or filter, but not both.
295+
// +kubebuilder:validation:MaxProperties:=1
296+
// +kubebuilder:validation:MinProperties:=1
297+
type QoSPolicyParam struct {
298+
// ID is the ID of the QoS policy to use. If ID is provided, filter cannot be provided. Must be in UUID format.
299+
// +kubebuilder:validation:Format:=uuid
300+
// +optional
301+
ID optional.String `json:"id,omitempty"`
302+
303+
// Filter specifies a filter to select an OpenStack QoS policy. If provided, cannot be empty.
304+
Filter *QoSPolicyFilter `json:"filter,omitempty"`
305+
}
306+
307+
// QoSPolicyFilter specifies a query to select an OpenStack router. At least one property must be set.
308+
// +kubebuilder:validation:MinProperties:=1
309+
type QoSPolicyFilter struct {
310+
Name string `json:"name,omitempty"`
311+
Description string `json:"description,omitempty"`
312+
ProjectID string `json:"projectID,omitempty"`
313+
Shared *bool `json:"shared,omitempty"`
314+
IsDefault *bool `json:"isDefault,omitempty"`
315+
316+
FilterByNeutronTags `json:",inline"`
317+
}
318+
293319
type PortOpts struct {
294320
// Network is a query for an openstack network that the port will be created or discovered on.
295321
// This will fail if the query returns more than one network.
@@ -326,6 +352,11 @@ type PortOpts struct {
326352
// +optional
327353
Trunk *bool `json:"trunk,omitempty"`
328354

355+
// QoSPolicy is a query for an openstack QoS policy that the port will use.
356+
// This will fail if the query returns more than one qos policy.
357+
// +optional
358+
QoSPolicy *QoSPolicyParam `json:"qosPolicy,omitempty"`
359+
329360
ResolvedPortSpecFields `json:",inline"`
330361
}
331362

@@ -422,6 +453,10 @@ type ResolvedPortSpec struct {
422453
// +listType=atomic
423454
SecurityGroups []string `json:"securityGroups,omitempty"`
424455

456+
// QoSPolicyID is the ID of the qos policy the port will use.
457+
// +optional
458+
QoSPolicyID *string `json:"qosPolicyID"`
459+
425460
ResolvedPortSpecFields `json:",inline"`
426461
}
427462

api/v1beta1/zz_generated.deepcopy.go

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

api_violations.report

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause
8282
API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time
8383
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding
8484
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType
85+
API rule violation: names_match,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1,PortOpts,QoSPolicy
8586
API rule violation: names_match,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1,ResolvedFixedIP,SubnetID
87+
API rule violation: names_match,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1,ResolvedPortSpec,QoSPolicyID
8688
API rule violation: names_match,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1,Router,IPs
8789
API rule violation: names_match,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1,SubnetFilter,IPv6AddressMode
8890
API rule violation: names_match,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1,SubnetFilter,IPv6RAMode

cmd/models-schema/zz_generated.openapi.go

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

0 commit comments

Comments
 (0)