Skip to content

Enable CSI based external volumes for agents - #552

Open
hajiler wants to merge 3 commits into
agent-substrate:mainfrom
hajiler:external-volumes-for-agent-branch
Open

Enable CSI based external volumes for agents#552
hajiler wants to merge 3 commits into
agent-substrate:mainfrom
hajiler:external-volumes-for-agent-branch

Conversation

@hajiler

@hajiler hajiler commented Jul 27, 2026

Copy link
Copy Markdown

#232

Integrate the with the volume interface created in #405, to enable CSI managed external volumes throughout the agent lifecycle.

  • [ X] Tests pass
  • Appropriate changes to documentation are included in the PR

@hajiler
hajiler force-pushed the external-volumes-for-agent-branch branch 6 times, most recently from c447f89 to f07fb92 Compare July 29, 2026 00:29
@hajiler
hajiler marked this pull request as ready for review July 29, 2026 00:31

@msau42 Michelle Au (msau42) 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.

Is there a way to squash the dynamic plugin registration commit with the earlier commits that used a binary flag? It would probably be less confusing for other reviewers that go commit by commit because the binary flag changes get completely replaced later on.

Also in the PR description can you provide a high level summary of the driver registration approach?

Comment thread internal/volume/csi/client.go
Comment thread internal/volume/csi/plugin.go
Comment thread internal/volume/csi/plugin.go
Comment thread internal/volume/csi/plugin.go
Comment thread cmd/ateapi/internal/controlapi/volumes.go Outdated
Comment thread pkg/api/v1alpha1/csidriverconfig_types.go Outdated
Comment thread hack/setup-csi-hostpath-kind.sh Outdated
Comment thread hack/setup-csi-hostpath-kind.sh
Comment thread manifests/ate-install/atelet.yaml Outdated
Comment thread manifests/ate-install/generated/ate.dev_csidriverconfigs.yaml
Comment thread hack/setup-csi-hostpath-kind.sh

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.

General comment: Avoid unpinned external references. They're a security risk and they make tests etc unreproducible.

  • container images (refer to by @ sha256 digest)
  • git repos (pin a git commit by hash or find an alternative)
  • install manifests (consider e.g. checking in a copy under a third_party directory)

@msau42 Michelle Au (msau42) self-assigned this Jul 31, 2026
@hajiler
hajiler force-pushed the external-volumes-for-agent-branch branch from f07fb92 to 2bc2eed Compare July 31, 2026 18:21
@zlammerts-svg Zheng Lammerts (zlammerts-svg) added this to the M2 milestone Jul 31, 2026
@hajiler
hajiler force-pushed the external-volumes-for-agent-branch branch 2 times, most recently from 3cbbf55 to 8cc2997 Compare July 31, 2026 20:29
Comment thread cmd/ateapi/internal/controlapi/volumes.go Outdated
Comment thread cmd/ateapi/internal/controlapi/volumes.go Outdated
Comment thread manifests/ate-install/atelet.yaml Outdated
hostPath:
path: /var/lib/ateom-gvisor
type: DirectoryOrCreate
- name: kubelet-plugins

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.

Double check if k8s volume reconstruction feature looks at this directory or not.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

IIUC it primarily uses /var/lib/kubelet/pods/ for volume discovery. Should I add that as well?

@hajiler
hajiler force-pushed the external-volumes-for-agent-branch branch 4 times, most recently from 8c54c5a to a9df0ea Compare August 4, 2026 23:22
@hajiler
hajiler force-pushed the external-volumes-for-agent-branch branch from a9df0ea to 7291838 Compare August 5, 2026 00:03

@msau42 Michelle Au (msau42) 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.

Can you also update the PR description to give a high level overview of the CSI driver registration and communication approach?

Comment thread manifests/ate-install/kind/atelet/kustomization.yaml
DriverName string `json:"driverName"`

// ControllerEndpoint is the gRPC endpoint for the CSI Controller service.
// Must be a valid URI (e.g. unix:///var/run/csi.sock or dns:///csi-service:9000).

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 would say remove it for now and we can consider adding it back if we need it.

Comment thread cmd/ateapi/internal/controlapi/service.go

// NewService creates a service. instruments may be nil; the record helpers no-op.
// PluginRegistry defines the interface for dynamic CSI plugin resolution.
type PluginRegistry interface {

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 would probably rename this to VolumePluginRegistry

Comment thread cmd/atelet/main.go
Comment thread internal/imagecache/implicitdirs_test.go
# 1. Ensure driver is cloned and checked out to pinned commit
if [ ! -d "${DRIVER_DIR}" ]; then
echo "CSI Hostpath Driver not found at ${DRIVER_DIR}. Cloning..."
git clone https://github.com/kubernetes-csi/csi-driver-host-path.git "${DRIVER_DIR}"

@msau42 Michelle Au (msau42) Aug 5, 2026

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 think Ben was suggesting that we copy the manifests directly in third_party directory so we don't introduce a dependency on another repo.

hostPath:
path: /var/lib/ateom-gvisor
type: DirectoryOrCreate
- name: kubelet-plugins

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.

Add a comment to explain what this directory is used for

func NewPlugin(client *Client) *Plugin {
return &Plugin{
client: client,
stagingDirPrefix: "/var/lib/ateom-gvisor/staging",

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.

Use ateompath helper to get the path

STATUS_DELETING = 3;
}
Status status = 4;
// volume_context contains metadata returned by the CSI driver during volume

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.

Does the CSI spec have any restrictions on syntax that we can add validation on?

// Matches the StorageClass referenced in ActorTemplate volume definitions.
//
// +required
// +kubebuilder:validation:MinLength=1

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.

You can reuse csidriver name validation that I'm adding in #678

// Must be a valid URI (e.g. unix:///var/run/csi.sock or dns:///csi-service:9000).
//
// +required
// +kubebuilder:validation:Pattern=`^(unix|tcp|dns)://.+$`

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 think we can harden the validation to be stricter for grpc endpoints. (can be done as a followup)

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.

4 participants