Manila: Share network#691
Conversation
|
Failed to assess the semver bump. See logs for details. |
4f9c96e to
46a1765
Compare
79282c8 to
08867bf
Compare
winiciusallan
left a comment
There was a problem hiding this comment.
Hey @dlaw4608, I left a few comments, but I need some more time to take a look at the other test scenarios. For now, let me know what you think about what it is commented.
| const ShareNetworkStatusInUse = "in-use" | ||
| const ShareNetworkStatusDeleting = "deleting" | ||
|
|
||
| const ( |
There was a problem hiding this comment.
I believe we're not using any of these statuses throughout the code, and it looks like we don't have a status field in the ShareNetwork struct on Gophercloud's side. Is this useful?
Maybe do we need to create an issue to address this?
There was a problem hiding this comment.
Yes you are correct they are not necessary here I removed them, thanks 👍
| - celExpr: "sharenetwork.status.resource.name == 'sharenetwork-create-full-override'" | ||
| - celExpr: "sharenetwork.status.resource.description == 'ShareNetwork from \"create full\" test'" |
There was a problem hiding this comment.
We don't need this check since KUTTL already matches fields from declaration vs status.
There was a problem hiding this comment.
Thanks for the Feedback @winiciusallan , i could of sworn i had already left these comments last week but clearly never actually clicked the big green button ack.
b5292e8 to
dacb270
Compare
eshulman2
left a comment
There was a problem hiding this comment.
Generally looks good, dded a few comments and question, please LMK what you think.
| enable_workaround_docker_io: 'false' | ||
| branch: ${{ matrix.openstack_version }} | ||
| enabled_services: "openstack-cli-server,neutron-trunk" | ||
| enabled_services: "openstack-cli-server,neutron-trunk,manila,m-api,m-sch,m-shr,m-dat" |
There was a problem hiding this comment.
This comment is not specific to this patch but I believe we should consider a coherent approach to the services we enable in the gates and possibly making specific gates with specific services enabled for certain controllers like being done in gophercloud for loadbalancers for example. @mandre WDYT?
There was a problem hiding this comment.
Agreed. At some point we'll have to split our jobs as they grow bigger (gophercloud is a good example).
| // networkRef is a reference to the ORC Network which this resource is associated with. | ||
| // +optional | ||
| // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="networkRef is immutable" | ||
| NetworkRef *KubernetesNameRef `json:"networkRef"` |
There was a problem hiding this comment.
Should there be a rule here that make sure that if a network is set the subnet is also set? from the api referance:
The UUID of a neutron network when setting up or updating a share network subnet with neutron. Specify both a neutron network and a neutron subnet that belongs to that neutron network.
There was a problem hiding this comment.
I agree! , I created a new validation rule
// +kubebuilder:validation:XValidation:rule="has(self.networkRef) == has(self.subnetRef)",message="networkRef and subnetRef must be specified together"
also added a test file in the apivalidations directory here, I used securitygroup_test.go and network_test.go as my main sources of reference (both in the apivalidations dir),
The CEL rule is a boolean equality and tests 4 combinations, both networkRef and subnetRef present = valid, both networkRef and subnetRef absent = valid aswell, but if either network Ref or subnetRef is missing or vice versa it is flagged as invalid.
The idea is to follow the API Ref statement creating a both or neither configuration rule.
The UUID of a neutron network when setting up or updating a share network subnet with neutron. Specify both a neutron network and a neutron subnet that belongs to that neutron network.
please lmk what you think 👍
eshulman2
left a comment
There was a problem hiding this comment.
regarding the gate failures
| ref: sharenetwork | ||
| assertAll: | ||
| - celExpr: "sharenetwork.status.id != ''" | ||
| - celExpr: "sharenetwork.status.resource.neutronNetID == '" |
There was a problem hiding this comment.
seems like there is something wrong with the test here:
harness.go:395: failed to prepare expression evaluation: failed to load expression(s): failed to build CEL program from expression "sharenetwork.status.resource.neutronNetID == '": type-check error: ERROR: <input>:1:46: Syntax error: token recognition error at: '''
| sharenetwork.status.resource.neutronNetID == '
| .............................................^
ERROR: <input>:1:47: Syntax error: mismatched input '<EOF>' expecting {'[', '{', '(', '.', '-', '!', 'true', 'false', 'null', NUM_FLOAT, NUM_INT, NUM_UINT, STRING, BYTES, IDENTIFIER}
| sharenetwork.status.resource.neutronNetID == '
| ..............................................^
I suspect it is a small typo yo have only a single ' instead of what I assumed you mean which is ' ' but I might be wrong
There was a problem hiding this comment.
Good Spot, thanks for the help @eshulman2 👍
|
Failed to assess the semver bump. See logs for details. |
mandre
left a comment
There was a problem hiding this comment.
Just an initial pass for now, I believe we should make the dependencies immutable unless we have more test coverage proving it works as expected, and that the resources that are no longer dependencies no longer have a finalizer.
| enable_workaround_docker_io: 'false' | ||
| branch: ${{ matrix.openstack_version }} | ||
| enabled_services: "openstack-cli-server,neutron-trunk" | ||
| enabled_services: "openstack-cli-server,neutron-trunk,manila,m-api,m-sch,m-shr,m-dat" |
There was a problem hiding this comment.
Agreed. At some point we'll have to split our jobs as they grow bigger (gophercloud is a good example).
| resource: | ||
| name: sharenetwork-create-full-override | ||
| description: ShareNetwork from "create full" test | ||
| # TODO(scaffolding): Add all fields the resource supports |
There was a problem hiding this comment.
What about SegmentationID, CIRD, NetworkType, ProjectID, etc. ? We should test their value, or lack thereof.
There was a problem hiding this comment.
You are correct, I have included comments noting the missing checks for these fields, I'm OK with this being a partial implementation/first iteration, so that I can use this resource as a dependency in the Share Controller and then return to fully implementing this controller in a separate PR?, WDYT @mandre
| status: | ||
| resource: | ||
| name: sharenetwork-create-minimal | ||
| # TODO(scaffolding): Add all fields the resource supports |
There was a problem hiding this comment.
There too, we should make sure the resulting resource is exactly as we expect it to be, including for absence of fields in its status.
| managementPolicy: managed | ||
| # TODO(scaffolding): Only add the mandatory fields. It's possible the resource | ||
| # doesn't have mandatory fields, in that case, leave it empty. | ||
| resource: {} |
There was a problem hiding this comment.
Just tried with openstack client and indeed all fields are optional:
❯ openstack share network create
+---------------------------------+-------------------------------------------+
| Field | Value |
+---------------------------------+-------------------------------------------+
| created_at | 2026-03-10T16:22:38.561269 |
| description | None |
| id | f267364b-d1b4-46d3-85b1-8baeeda3831a |
| name | None |
| project_id | c73b7097d07c46f78eb4b4dcfbac5ca8 |
| security_service_update_support | True |
| share_network_subnets | |
| | id = 227458f7-22f6-4574-9edb-9ee57d37e6cc |
| | availability_zone = None |
| | created_at = 2026-03-10T16:22:38.580313 |
| | updated_at = None |
| | segmentation_id = None |
| | neutron_net_id = None |
| | neutron_subnet_id = None |
| | ip_version = None |
| | cidr = None |
| | network_type = None |
| | mtu = None |
| | gateway = None |
| status | active |
| updated_at | None |
+---------------------------------+-------------------------------------------+
| resource: | ||
| name: sharenetwork-update-updated | ||
| description: sharenetwork-update-updated | ||
| # TODO(scaffolding): match all fields that were modified |
There was a problem hiding this comment.
We need to validate that updating networkRef and subnetRef had any effect.
There was a problem hiding this comment.
Removed as they are both set as immutable.
| handleNameUpdate(&updateOpts, obj, osResource) | ||
| handleDescriptionUpdate(&updateOpts, resource, osResource) | ||
|
|
||
| // TODO(scaffolding): add handler for all fields supporting mutability |
There was a problem hiding this comment.
We should add a dependence on network and subnet here, and ensure we set the updateOpts correctly.
We may also need to remove the finalizer on the old dependencies, that might be a tricky one to handle. I would suggest you make the dependencies immutable for now.
There was a problem hiding this comment.
Agreed, the dependencies are set as immutable for the time being 👍
995c9dd to
5a7e8ba
Compare
go run ./cmd/scaffold-controller -interactive=false \
-kind=ShareNetwork \
-gophercloud-client=NewSharedFilesystemV2 \
-gophercloud-module=github.com/gophercloud/gophercloud/v2/openstack/sharedfilesystems/v2/sharenetworks \
-gophercloud-type=ShareNetwork \
-openstack-json-object=share_network \
-optional-create-dependency=Network \
-optional-create-dependency=Subnet
Signed-off-by: Daniel Lawton <dlawton@redhat.com>
af8bc6d to
4caee9b
Compare
|
I think this PR is good to go for another look @mandre |
mandre
left a comment
There was a problem hiding this comment.
I haven't finished reviewing, but leaving some comments here already.
| ref: sharenetwork | ||
| assertAll: | ||
| - celExpr: "sharenetwork.status.id != ''" | ||
| - celExpr: "sharenetwork.status.resource.neutronNetID == ''" |
There was a problem hiding this comment.
We now need to ensure these fields are unset.
8aa3bed to
3efb578
Compare
Implements ShareNetwork controller to manage Manila share networks. - E2E tests included - API configured - Manila enabled in CI Signed-off-by: Daniel Lawton <dlawton@redhat.com> Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add support for Openstack Manila Service Share Network resource
Closes: #687