csi

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package csi is gitd's Kubernetes CSI node plugin: a pod asks for a workspace like any volume — an ephemeral inline volume of the driver gitd.dev — and gets a copy-on-write checkout, made by the gitd on its node, with no credential in the pod.

The plugin asks gitd for a workspace that carries its pool inside it (pool_inside), mounts the pool's objects read-only at the workspace's .git/gitd-pool, and binds the workspace onto the pod's volume. When the pod goes it unmounts both and gitd removes the workspace. CSI node plugins are privileged by design: that is where the privilege to mount belongs, not in gitd, nor in the pod.

Index

Constants

View Source
const DriverName = "gitd.dev"

DriverName is the name pods ask for: `csi: { driver: gitd.dev }`.

Variables

This section is empty.

Functions

func Ready

func Ready(tenants map[string]Tenant) func(context.Context) error

Ready says whether every tenant's gitd answers.

func Serve

func Serve(ctx context.Context, path string, identity *Identity, node *Node) error

Serve answers kubelet on the Unix socket at path until ctx ends.

func TenantsOf

func TenantsOf(socket, root string, given []string) (map[string]Tenant, error)

TenantsOf reads which tenants the plugin serves: the implicit one at root, when gitd has none, and each `name=root,keyfile` given, reached on gitd's socket with that key.

Types

type Asked

type Asked struct {
	Repository string
	Branch     string
	Commit     string
	Tenant     string
	// Name tells apart two gitd volumes of one pod.
	Name      string
	Namespace string
	Pod       string
}

Asked is what a pod's volume asks for, from its volume attributes.

type Identity

type Identity struct {
	csi.UnimplementedIdentityServer
	Version string
	// Ready says whether gitd answers.
	Ready func(context.Context) error
}

Identity answers who the plugin is, and whether the gitd it needs answers.

func (*Identity) GetPluginCapabilities

GetPluginCapabilities offers nothing beyond a node plugin: no controller, no topology.

func (*Identity) GetPluginInfo

GetPluginInfo names the driver.

func (*Identity) Probe

func (identity *Identity) Probe(ctx context.Context, _ *csi.ProbeRequest) (*csi.ProbeResponse, error)

Probe says the plugin is ready once gitd answers.

type Node

type Node struct {
	csi.UnimplementedNodeServer
	NodeID  string
	Tenants map[string]Tenant
	Records Records
}

Node is the plugin's node service: it publishes an ephemeral volume as a workspace of the gitd on its node, and unpublishes it.

func (*Node) NodeGetCapabilities

NodeGetCapabilities offers nothing beyond publishing: no staging, no stats, no expansion.

func (*Node) NodeGetInfo

NodeGetInfo names the node.

func (*Node) NodePublishVolume

func (node *Node) NodePublishVolume(ctx context.Context, request *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)

NodePublishVolume makes the pod's workspace and mounts it at the volume's target: gitd makes it carrying its pool, the pool's objects are mounted read-only inside it, and the workspace is bound onto the target. Publishing a volume already published changes nothing.

func (*Node) NodeUnpublishVolume

func (node *Node) NodeUnpublishVolume(ctx context.Context, request *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)

NodeUnpublishVolume unmounts the volume and has gitd remove its workspace.

type Records

type Records struct {
	Dir string
}

Records are the volumes the plugin published, one file each under Dir.

type Tenant

type Tenant struct {
	Root       string
	Workspaces Workspaces
}

Tenant is one tenant's gitd as the plugin reaches it, and the root its workspaces are made in; the implicit tenant, when gitd has none, is named "".

type Workspaces

type Workspaces interface {
	Prepare(ctx context.Context, request *gitdv1.PrepareRequest) (*gitdv1.WorkspaceResult, error)
	Remove(ctx context.Context, path string) error
}

Workspaces are what the plugin needs of gitd, for one tenant: making a workspace and removing it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL