Skip to content

feat(volumes): Add volume 'access_mode' flag#341

Open
craciunoiuc wants to merge 2 commits into
stagingfrom
craciunoiuc/add-vol-access-mode
Open

feat(volumes): Add volume 'access_mode' flag#341
craciunoiuc wants to merge 2 commits into
stagingfrom
craciunoiuc/add-vol-access-mode

Conversation

@craciunoiuc
Copy link
Copy Markdown
Member

This allows for mounting volumes in multiple instances.
The access mode can't be edited after creation, as such
there is no support for patching.

Closes: TOOL-826

Also adapt fields to new formats.

Signed-off-by: Cezar Craciunoiu <cezar@unikraft.io>
This allows for mounting volumes in multiple instances.
The access mode can't be edited after creation, as such
there is no support for patching.

Signed-off-by: Cezar Craciunoiu <cezar@unikraft.io>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for configuring a volume’s access mode at creation time (to enable multi-instance mounting scenarios) and updates CLI code to match recent SDK signature/type changes.

Changes:

  • Introduce types.AccessMode (validated wrapper over platform.VolumeAccessMode) and wire --access-mode into unikraft volume create.
  • Include access-mode in volume field mirroring/output/help fixtures and add integration coverage for rwo/rox.
  • Update several SDK callsites for breaking SDK changes (e.g., DestinationPort and log tail now pointers) and bump unikraft.com/cloud/sdk.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/volimport/volimport.go Update service port mapping to use pointer DestinationPort per SDK change.
internal/types/states.go Add types.AccessMode with validation for allowed volume access modes.
internal/cmd/volumes.go Add --access-mode shortcut flag and map it into CreateVolumeRequest.AccessMode; update examples.
internal/cmd/testdata/TestOutput/volumes Update expected output/field metadata to include access-mode.
internal/cmd/services.go Update DestinationPort usage to pointer per SDK change.
internal/cmd/run.go Update instance log reader call to pass tail as a pointer per SDK change.
internal/cmd/instances.go Update DestinationPort and change instance logs --tail flag type to *int for optionality.
internal/cmd/instances_tui.go Update TUI log reader call for new tail pointer signature (currently contains a compile issue).
go.mod / go.sum Bump unikraft.com/cloud/sdk dependency.
cmd/unikraft/testdata/TestHelp/volumes Update help golden file to include access-mode flag/field.
cmd/unikraft/integration/volume_test.go Add integration tests validating access-mode behavior (rwo, rox).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/cmd/instances_tui.go
Copy link
Copy Markdown
Member

@jedevc jedevc left a comment

Choose a reason for hiding this comment

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

Looks mostly good, left some comments. Once fixed, we can merge after the feature freeze is over.

filesystem: ext4
quota-policy: hard
persistent: true
access-mode:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, why empty? Shouldn't the struct be updated so the gen of this is correct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good question, need to recheck, I think I'm setting it to empty in the request to make the platform decide

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: just noticed that this golden file (and maybe others) don't have the right linguist-generated gitattributes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

what the hyok is that? 👀

Comment thread internal/cmd/volumes.go
--size 10 \
--metro fra`,
--metro fra \
--access-mode rwo`,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to add the access-mode to this specific example, IMO, it should just be a very basic example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants