diff --git a/api/v1alpha1/port_types.go b/api/v1alpha1/port_types.go
index 868748c1..22ca3ed7 100644
--- a/api/v1alpha1/port_types.go
+++ b/api/v1alpha1/port_types.go
@@ -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"`
}
@@ -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 {
diff --git a/cmd/models-schema/zz_generated.openapi.go b/cmd/models-schema/zz_generated.openapi.go
index 8eab33c2..37432d6b 100644
--- a/cmd/models-schema/zz_generated.openapi.go
+++ b/cmd/models-schema/zz_generated.openapi.go
@@ -4540,6 +4540,13 @@ func schema_openstack_resource_controller_v2_api_v1alpha1_PortFilter(ref common.
Format: "",
},
},
+ "macAddress": {
+ SchemaProps: spec.SchemaProps{
+ Description: "macAddress is the MAC address of the port.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
"tags": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
@@ -4895,6 +4902,13 @@ func schema_openstack_resource_controller_v2_api_v1alpha1_PortResourceSpec(ref c
Format: "",
},
},
+ "macAddress": {
+ SchemaProps: spec.SchemaProps{
+ Description: "macAddress is the MAC address of the port.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
},
Required: []string{"networkRef"},
},
diff --git a/config/crd/bases/openstack.k-orc.cloud_ports.yaml b/config/crd/bases/openstack.k-orc.cloud_ports.yaml
index 64c66bbf..6b96e097 100644
--- a/config/crd/bases/openstack.k-orc.cloud_ports.yaml
+++ b/config/crd/bases/openstack.k-orc.cloud_ports.yaml
@@ -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
@@ -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.
diff --git a/internal/controllers/port/actuator.go b/internal/controllers/port/actuator.go
index 57064562..61c23c7b 100644
--- a/internal/controllers/port/actuator.go
+++ b/internal/controllers/port/actuator.go
@@ -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
@@ -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 {
diff --git a/internal/controllers/port/status.go b/internal/controllers/port/status.go
index d740caac..0a15c7a6 100644
--- a/internal/controllers/port/status.go
+++ b/internal/controllers/port/status.go
@@ -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)
diff --git a/internal/controllers/port/tests/port-create-full/00-assert.yaml b/internal/controllers/port/tests/port-create-full/00-assert.yaml
index 3f2ea075..3c866dbb 100644
--- a/internal/controllers/port/tests/port-create-full/00-assert.yaml
+++ b/internal/controllers/port/tests/port-create-full/00-assert.yaml
@@ -15,6 +15,7 @@ status:
propagateUplinkStatus: false
status: DOWN
vnicType: direct
+ macAddress: fa:16:3e:23:fd:d7
tags:
- tag1
---
@@ -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'"
diff --git a/internal/controllers/port/tests/port-create-full/00-create-resource.yaml b/internal/controllers/port/tests/port-create-full/00-create-resource.yaml
index 31174591..1721a83a 100644
--- a/internal/controllers/port/tests/port-create-full/00-create-resource.yaml
+++ b/internal/controllers/port/tests/port-create-full/00-create-resource.yaml
@@ -84,3 +84,4 @@ spec:
portSecurity: Enabled
vnicType: direct
projectRef: port-create-full
+ macAddress: fa:16:3e:23:fd:d7
diff --git a/internal/controllers/port/tests/port-import/00-import-resource.yaml b/internal/controllers/port/tests/port-import/00-import-resource.yaml
index bed7543b..0b58377d 100644
--- a/internal/controllers/port/tests/port-import/00-import-resource.yaml
+++ b/internal/controllers/port/tests/port-import/00-import-resource.yaml
@@ -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
diff --git a/internal/controllers/port/tests/port-import/02-assert.yaml b/internal/controllers/port/tests/port-import/02-assert.yaml
index ff074556..3ef560d8 100644
--- a/internal/controllers/port/tests/port-import/02-assert.yaml
+++ b/internal/controllers/port/tests/port-import/02-assert.yaml
@@ -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
diff --git a/internal/controllers/port/tests/port-import/02-create-resource.yaml b/internal/controllers/port/tests/port-import/02-create-resource.yaml
index 838d1d0d..bbd3842b 100644
--- a/internal/controllers/port/tests/port-import/02-create-resource.yaml
+++ b/internal/controllers/port/tests/port-import/02-create-resource.yaml
@@ -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
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/portfilter.go b/pkg/clients/applyconfiguration/api/v1alpha1/portfilter.go
index e1732f65..ab6d6e18 100644
--- a/pkg/clients/applyconfiguration/api/v1alpha1/portfilter.go
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/portfilter.go
@@ -30,6 +30,7 @@ type PortFilterApplyConfiguration struct {
NetworkRef *apiv1alpha1.KubernetesNameRef `json:"networkRef,omitempty"`
ProjectRef *apiv1alpha1.KubernetesNameRef `json:"projectRef,omitempty"`
AdminStateUp *bool `json:"adminStateUp,omitempty"`
+ MACAddress *string `json:"macAddress,omitempty"`
FilterByNeutronTagsApplyConfiguration `json:",inline"`
}
@@ -79,6 +80,14 @@ func (b *PortFilterApplyConfiguration) WithAdminStateUp(value bool) *PortFilterA
return b
}
+// WithMACAddress sets the MACAddress field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the MACAddress field is set to the value of the last call.
+func (b *PortFilterApplyConfiguration) WithMACAddress(value string) *PortFilterApplyConfiguration {
+ b.MACAddress = &value
+ return b
+}
+
// WithTags adds the given value to the Tags field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Tags field.
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/portresourcespec.go b/pkg/clients/applyconfiguration/api/v1alpha1/portresourcespec.go
index 67351b05..ac7d4ed0 100644
--- a/pkg/clients/applyconfiguration/api/v1alpha1/portresourcespec.go
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/portresourcespec.go
@@ -36,6 +36,7 @@ type PortResourceSpecApplyConfiguration struct {
VNICType *string `json:"vnicType,omitempty"`
PortSecurity *apiv1alpha1.PortSecurityState `json:"portSecurity,omitempty"`
ProjectRef *apiv1alpha1.KubernetesNameRef `json:"projectRef,omitempty"`
+ MACAddress *string `json:"macAddress,omitempty"`
}
// PortResourceSpecApplyConfiguration constructs a declarative configuration of the PortResourceSpec type for use with
@@ -145,3 +146,11 @@ func (b *PortResourceSpecApplyConfiguration) WithProjectRef(value apiv1alpha1.Ku
b.ProjectRef = &value
return b
}
+
+// WithMACAddress sets the MACAddress field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the MACAddress field is set to the value of the last call.
+func (b *PortResourceSpecApplyConfiguration) WithMACAddress(value string) *PortResourceSpecApplyConfiguration {
+ b.MACAddress = &value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/internal/internal.go b/pkg/clients/applyconfiguration/internal/internal.go
index 5b5cb514..e3cbf859 100644
--- a/pkg/clients/applyconfiguration/internal/internal.go
+++ b/pkg/clients/applyconfiguration/internal/internal.go
@@ -1244,6 +1244,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: description
type:
scalar: string
+ - name: macAddress
+ type:
+ scalar: string
- name: name
type:
scalar: string
@@ -1330,6 +1333,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: description
type:
scalar: string
+ - name: macAddress
+ type:
+ scalar: string
- name: name
type:
scalar: string
diff --git a/website/docs/crd-reference.md b/website/docs/crd-reference.md
index 23b3b240..da7cd698 100644
--- a/website/docs/crd-reference.md
+++ b/website/docs/crd-reference.md
@@ -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
MinLength: 1
|
| `projectRef` _[KubernetesNameRef](#kubernetesnameref)_ | projectRef is a reference to the ORC Project this resource is associated with.
Typically, only used by admin. | | MaxLength: 253
MinLength: 1
|
| `adminStateUp` _boolean_ | adminStateUp is the administrative state of the port,
which is up (true) or down (false). | | |
+| `macAddress` _string_ | macAddress is the MAC address of the port. | | MaxLength: 32
|
| `tags` _[NeutronTag](#neutrontag) array_ | tags is a list of tags to filter by. If specified, the resource must
have all of the tags specified to be included in the result. | | MaxItems: 64
MaxLength: 255
MinLength: 1
|
| `tagsAny` _[NeutronTag](#neutrontag) array_ | tagsAny is a list of tags to filter by. If specified, the resource
must have at least one of the tags specified to be included in the
result. | | MaxItems: 64
MaxLength: 255
MinLength: 1
|
| `notTags` _[NeutronTag](#neutrontag) array_ | notTags is a list of tags to filter by. If specified, resources which
contain all of the given tags will be excluded from the result. | | MaxItems: 64
MaxLength: 255
MinLength: 1
|
@@ -2169,6 +2170,7 @@ _Appears in:_
| `vnicType` _string_ | vnicType specifies the type of vNIC which this port should be
attached to. This is used to determine which mechanism driver(s) to
be used to bind the port. The valid values are normal, macvtap,
direct, baremetal, direct-physical, virtio-forwarder, smart-nic and
remote-managed, although these values will not be validated in this
API to ensure compatibility with future neutron changes or custom
implementations. What type of vNIC is actually available depends on
deployments. If not specified, the Neutron default value is used. | | MaxLength: 64
|
| `portSecurity` _[PortSecurityState](#portsecuritystate)_ | portSecurity controls port security for this port.
When set to Enabled, port security is enabled.
When set to Disabled, port security is disabled and SecurityGroupRefs must be empty.
When set to Inherit (default), it takes the value from the network level. | Inherit | Enum: [Enabled Disabled Inherit]
|
| `projectRef` _[KubernetesNameRef](#kubernetesnameref)_ | projectRef is a reference to the ORC Project this resource is associated with.
Typically, only used by admin. | | MaxLength: 253
MinLength: 1
|
+| `macAddress` _string_ | macAddress is the MAC address of the port. | | MaxLength: 32
|
#### PortResourceStatus