Skip to content

Manila: Share network#691

Merged
mandre merged 2 commits into
k-orc:mainfrom
dlaw4608:share_network
Jun 5, 2026
Merged

Manila: Share network#691
mandre merged 2 commits into
k-orc:mainfrom
dlaw4608:share_network

Conversation

@dlaw4608

Copy link
Copy Markdown
Contributor

Add support for Openstack Manila Service Share Network resource
Closes: #687

@github-actions

Copy link
Copy Markdown

Failed to assess the semver bump. See logs for details.

@github-actions github-actions Bot added the semver:major Breaking change label Feb 24, 2026
@dlaw4608 dlaw4608 force-pushed the share_network branch 2 times, most recently from 79282c8 to 08867bf Compare February 24, 2026 19:10
@dlaw4608 dlaw4608 marked this pull request as ready for review February 25, 2026 10:21

@winiciusallan winiciusallan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread api/v1alpha1/sharenetwork_types.go
const ShareNetworkStatusInUse = "in-use"
const ShareNetworkStatusDeleting = "deleting"

const (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are correct they are not necessary here I removed them, thanks 👍

Comment on lines +37 to +38
- celExpr: "sharenetwork.status.resource.name == 'sharenetwork-create-full-override'"
- celExpr: "sharenetwork.status.resource.description == 'ShareNetwork from \"create full\" test'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this check since KUTTL already matches fields from declaration vs status.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It happens 😄

@dlaw4608 dlaw4608 force-pushed the share_network branch 2 times, most recently from b5292e8 to dacb270 Compare March 4, 2026 18:29

@eshulman2 eshulman2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, dded a few comments and question, please LMK what you think.

Comment thread .github/workflows/e2e.yaml Outdated
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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. At some point we'll have to split our jobs as they grow bigger (gophercloud is a good example).

Comment thread api/v1alpha1/sharenetwork_types.go Outdated
// 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"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread api/v1alpha1/sharenetwork_types.go
Comment thread api/v1alpha1/sharenetwork_types.go

@eshulman2 eshulman2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding the gate failures

ref: sharenetwork
assertAll:
- celExpr: "sharenetwork.status.id != ''"
- celExpr: "sharenetwork.status.resource.neutronNetID == '"

@eshulman2 eshulman2 Mar 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Spot, thanks for the help @eshulman2 👍

@github-actions github-actions Bot removed the semver:major Breaking change label Mar 9, 2026
@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown

Failed to assess the semver bump. See logs for details.

@github-actions github-actions Bot added the semver:major Breaking change label Mar 9, 2026

@mandre mandre left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/e2e.yaml Outdated
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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. At some point we'll have to split our jobs as they grow bigger (gophercloud is a good example).

Comment thread api/v1alpha1/sharenetwork_types.go
resource:
name: sharenetwork-create-full-override
description: ShareNetwork from "create full" test
# TODO(scaffolding): Add all fields the resource supports

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about SegmentationID, CIRD, NetworkType, ProjectID, etc. ? We should test their value, or lack thereof.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered above ☝️

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: {}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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                                      |
+---------------------------------+-------------------------------------------+

Comment thread api/v1alpha1/sharenetwork_types.go
resource:
name: sharenetwork-update-updated
description: sharenetwork-update-updated
# TODO(scaffolding): match all fields that were modified

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to validate that updating networkRef and subnetRef had any effect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the dependencies are set as immutable for the time being 👍

@dlaw4608 dlaw4608 force-pushed the share_network branch 6 times, most recently from 995c9dd to 5a7e8ba Compare March 16, 2026 18:46
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>
@dlaw4608 dlaw4608 force-pushed the share_network branch 3 times, most recently from af8bc6d to 4caee9b Compare June 2, 2026 15:33
@dlaw4608

dlaw4608 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

I think this PR is good to go for another look @mandre

@mandre mandre left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't finished reviewing, but leaving some comments here already.

Comment thread internal/controllers/sharenetwork/actuator.go Outdated
Comment thread internal/controllers/sharenetwork/actuator.go Outdated
Comment thread internal/controllers/sharenetwork/actuator.go Outdated
Comment thread internal/controllers/sharenetwork/status.go Outdated
Comment thread internal/controllers/sharenetwork/actuator.go Outdated
Comment thread README.md Outdated
ref: sharenetwork
assertAll:
- celExpr: "sharenetwork.status.id != ''"
- celExpr: "sharenetwork.status.resource.neutronNetID == ''"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now need to ensure these fields are unset.

@dlaw4608 dlaw4608 force-pushed the share_network branch 2 times, most recently from 8aa3bed to 3efb578 Compare June 5, 2026 10:05
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>
@mandre mandre added this pull request to the merge queue Jun 5, 2026
Merged via the queue into k-orc:main with commit 46a7c89 Jun 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver:major Breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manila: Share Network Controller

4 participants