Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions api/v1alpha1/port_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ type PortFilter struct {
// +optional
AdminStateUp *bool `json:"adminStateUp,omitempty"`

// macAddress is the MAC address of the port.
// +kubebuilder:validation:MaxLength=32
// +optional
MACAddress string `json:"macAddress,omitempty"`

FilterByNeutronTags `json:",inline"`
}

Expand Down Expand Up @@ -170,6 +175,11 @@ type PortResourceSpec struct {
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

// macAddress is the MAC address of the port.
// +kubebuilder:validation:MaxLength=32
// +optional
MACAddress string `json:"macAddress,omitempty"`
}

type PortResourceStatus struct {
Expand Down
14 changes: 14 additions & 0 deletions cmd/models-schema/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions config/crd/bases/openstack.k-orc.cloud_ports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ spec:
maxLength: 255
minLength: 1
type: string
macAddress:
description: macAddress is the MAC address of the port.
maxLength: 32
type: string
name:
description: name of the existing resource
maxLength: 255
Expand Down Expand Up @@ -294,6 +298,10 @@ spec:
maxLength: 255
minLength: 1
type: string
macAddress:
description: macAddress is the MAC address of the port.
maxLength: 32
type: string
name:
description: name is a human-readable name of the port. If not
set, the object's name will be used.
Expand Down
2 changes: 2 additions & 0 deletions internal/controllers/port/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func (actuator portActuator) ListOSResourcesForImport(ctx context.Context, obj o
NotTags: tags.Join(filter.NotTags),
NotTagsAny: tags.Join(filter.NotTagsAny),
AdminStateUp: filter.AdminStateUp,
MACAddress: filter.MACAddress,
}

return actuator.osClient.ListPort(ctx, listOpts), nil
Expand Down Expand Up @@ -197,6 +198,7 @@ func (actuator portActuator) CreateResource(ctx context.Context, obj *orcv1alpha
Description: string(ptr.Deref(resource.Description, "")),
ProjectID: projectID,
AdminStateUp: resource.AdminStateUp,
MACAddress: resource.MACAddress,
}

if len(resource.AllowedAddressPairs) > 0 {
Expand Down
3 changes: 2 additions & 1 deletion internal/controllers/port/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ func (portStatusWriter) ApplyResourceStatus(log logr.Logger, osResource *osResou
WithRevisionNumber(int64(osResource.RevisionNumber)).
WithCreatedAt(metav1.NewTime(osResource.CreatedAt)).
WithUpdatedAt(metav1.NewTime(osResource.UpdatedAt)).
WithAdminStateUp(osResource.AdminStateUp)
WithAdminStateUp(osResource.AdminStateUp).
WithMACAddress(osResource.MACAddress)

if osResource.Description != "" {
resourceStatus.WithDescription(osResource.Description)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ status:
propagateUplinkStatus: false
status: DOWN
vnicType: direct
macAddress: fa:16:3e:23:fd:d7
tags:
- tag1
---
Expand All @@ -41,7 +42,6 @@ assertAll:
- celExpr: "port.status.id != ''"
- celExpr: "port.status.resource.createdAt != ''"
- celExpr: "port.status.resource.updatedAt != ''"
- celExpr: "port.status.resource.macAddress != ''"
- celExpr: "port.status.resource.revisionNumber > 0"
- celExpr: "port.status.resource.fixedIPs[0].subnetID == subnet.status.id"
- celExpr: "port.status.resource.fixedIPs[0].ip == '192.168.155.122'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ spec:
portSecurity: Enabled
vnicType: direct
projectRef: port-create-full
macAddress: fa:16:3e:23:fd:d7
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ spec:
name: port-import-external
description: Port from "port-import" test
adminStateUp: false
macAddress: fa:16:3e:23:fd:d7
tags:
- tag1
1 change: 1 addition & 0 deletions internal/controllers/port/tests/port-import/02-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ status:
name: port-import-external
description: Port from "port-import" test
adminStateUp: false
macAddress: fa:16:3e:23:fd:d7
tags:
- tag1
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ spec:
networkRef: port-import
description: Port from "port-import" test
adminStateUp: false
macAddress: fa:16:3e:23:fd:d7
tags:
- tag1
9 changes: 9 additions & 0 deletions pkg/clients/applyconfiguration/api/v1alpha1/portfilter.go

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.

6 changes: 6 additions & 0 deletions pkg/clients/applyconfiguration/internal/internal.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions website/docs/crd-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2070,6 +2070,7 @@ _Appears in:_
| `networkRef` _[KubernetesNameRef](#kubernetesnameref)_ | networkRef is a reference to the ORC Network which this port is associated with. | | MaxLength: 253 <br />MinLength: 1 <br /> |
| `projectRef` _[KubernetesNameRef](#kubernetesnameref)_ | projectRef is a reference to the ORC Project this resource is associated with.<br />Typically, only used by admin. | | MaxLength: 253 <br />MinLength: 1 <br /> |
| `adminStateUp` _boolean_ | adminStateUp is the administrative state of the port,<br />which is up (true) or down (false). | | |
| `macAddress` _string_ | macAddress is the MAC address of the port. | | MaxLength: 32 <br /> |
| `tags` _[NeutronTag](#neutrontag) array_ | tags is a list of tags to filter by. If specified, the resource must<br />have all of the tags specified to be included in the result. | | MaxItems: 64 <br />MaxLength: 255 <br />MinLength: 1 <br /> |
| `tagsAny` _[NeutronTag](#neutrontag) array_ | tagsAny is a list of tags to filter by. If specified, the resource<br />must have at least one of the tags specified to be included in the<br />result. | | MaxItems: 64 <br />MaxLength: 255 <br />MinLength: 1 <br /> |
| `notTags` _[NeutronTag](#neutrontag) array_ | notTags is a list of tags to filter by. If specified, resources which<br />contain all of the given tags will be excluded from the result. | | MaxItems: 64 <br />MaxLength: 255 <br />MinLength: 1 <br /> |
Expand Down Expand Up @@ -2169,6 +2170,7 @@ _Appears in:_
| `vnicType` _string_ | vnicType specifies the type of vNIC which this port should be<br />attached to. This is used to determine which mechanism driver(s) to<br />be used to bind the port. The valid values are normal, macvtap,<br />direct, baremetal, direct-physical, virtio-forwarder, smart-nic and<br />remote-managed, although these values will not be validated in this<br />API to ensure compatibility with future neutron changes or custom<br />implementations. What type of vNIC is actually available depends on<br />deployments. If not specified, the Neutron default value is used. | | MaxLength: 64 <br /> |
| `portSecurity` _[PortSecurityState](#portsecuritystate)_ | portSecurity controls port security for this port.<br />When set to Enabled, port security is enabled.<br />When set to Disabled, port security is disabled and SecurityGroupRefs must be empty.<br />When set to Inherit (default), it takes the value from the network level. | Inherit | Enum: [Enabled Disabled Inherit] <br /> |
| `projectRef` _[KubernetesNameRef](#kubernetesnameref)_ | projectRef is a reference to the ORC Project this resource is associated with.<br />Typically, only used by admin. | | MaxLength: 253 <br />MinLength: 1 <br /> |
| `macAddress` _string_ | macAddress is the MAC address of the port. | | MaxLength: 32 <br /> |


#### PortResourceStatus
Expand Down