filesystem

package
v0.18.5 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package filesystem is the filesystem-backed implementation of the unified muster client interface defined in the parent client package. Each muster CRD is stored as a YAML file under per-resource-type folders rooted at basePath. See ../doc.go for the full architecture.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a filesystem-backed implementation of the muster client interface.

Files live directly under per-resource-type folders (no namespace subdirectories):

  • MCPServers: {basePath}/mcpservers/{name}.yaml
  • Workflows: {basePath}/workflows/{name}.yaml

Per-domain CRUD methods live in sibling files (mcpserver.go, workflow.go, events.go). This file keeps the type, the controller-runtime Client interface methods, shared helpers, and the sub-resource writer types.

func New

func New(basePath string) *Client

New returns a filesystem-backed Client rooted at basePath. An empty basePath defaults to the current working directory.

func (*Client) Apply

Apply is unsupported (filesystem has no server-side apply).

func (*Client) Close

func (f *Client) Close() error

Close performs cleanup for the filesystem client.

func (*Client) Create

func (f *Client) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

Create creates a new resource (implements client.Client interface).

func (*Client) CreateEvent

func (f *Client) CreateEvent(ctx context.Context, obj client.Object, reason, message, eventType string) error

CreateEvent logs an event for the given object in filesystem mode.

func (*Client) CreateEventForCRD

func (f *Client) CreateEventForCRD(ctx context.Context, crdType, name, namespace, reason, message, eventType string) error

CreateEventForCRD logs an event for a CRD by type, name, and namespace in filesystem mode.

func (*Client) CreateMCPServer

func (f *Client) CreateMCPServer(_ context.Context, server *musterv1alpha1.MCPServer) error

func (*Client) CreateWorkflow

func (f *Client) CreateWorkflow(_ context.Context, w *musterv1alpha1.Workflow) error

func (*Client) Delete

func (f *Client) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

Delete deletes a resource (implements client.Client interface).

func (*Client) DeleteAllOf

func (f *Client) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

DeleteAllOf is unsupported.

func (*Client) DeleteMCPServer

func (f *Client) DeleteMCPServer(_ context.Context, name, _ string) error

func (*Client) DeleteWorkflow

func (f *Client) DeleteWorkflow(_ context.Context, name, _ string) error

func (*Client) Get

func (f *Client) Get(ctx context.Context, key types.NamespacedName, obj client.Object, opts ...client.GetOption) error

Get retrieves a resource by name and namespace (implements client.Client interface).

func (*Client) GetMCPServer

func (f *Client) GetMCPServer(_ context.Context, name, _ string) (*musterv1alpha1.MCPServer, error)

func (*Client) GetWorkflow

func (f *Client) GetWorkflow(_ context.Context, name, _ string) (*musterv1alpha1.Workflow, error)

func (*Client) GroupVersionKindFor

func (f *Client) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error)

GroupVersionKindFor returns the GroupVersionKind for an object.

func (*Client) IsKubernetesMode

func (f *Client) IsKubernetesMode() bool

IsKubernetesMode returns false since this is the filesystem implementation.

func (*Client) IsObjectNamespaced

func (f *Client) IsObjectNamespaced(obj runtime.Object) (bool, error)

IsObjectNamespaced — all muster resources are namespaced.

func (*Client) List

func (f *Client) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

List retrieves a list of resources (implements client.Client interface).

func (*Client) ListMCPServers

func (f *Client) ListMCPServers(_ context.Context, _ string) ([]musterv1alpha1.MCPServer, error)

func (*Client) ListWorkflows

func (f *Client) ListWorkflows(_ context.Context, _ string) ([]musterv1alpha1.Workflow, error)

func (*Client) Patch

func (f *Client) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

Patch falls back to Update — filesystem can't compute a partial patch.

func (*Client) QueryEvents

func (f *Client) QueryEvents(ctx context.Context, options api.EventQueryOptions) (*api.EventQueryResult, error)

QueryEvents retrieves events based on filtering options from filesystem storage.

func (*Client) RESTMapper

func (f *Client) RESTMapper() meta.RESTMapper

RESTMapper returns nil — filesystem mode doesn't need REST mapping.

func (*Client) Scheme

func (f *Client) Scheme() *runtime.Scheme

Scheme returns the scheme (implements client.Client interface).

func (*Client) Status

func (f *Client) Status() client.StatusWriter

Status returns a status writer (implements client.Client interface).

func (*Client) SubResource

func (f *Client) SubResource(subResource string) client.SubResourceClient

SubResource returns a sub-resource client (implements client.Client interface).

func (*Client) Update

func (f *Client) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

Update updates an existing resource (implements client.Client interface).

func (*Client) UpdateMCPServer

func (f *Client) UpdateMCPServer(_ context.Context, server *musterv1alpha1.MCPServer) error

func (*Client) UpdateMCPServerStatus

func (f *Client) UpdateMCPServerStatus(ctx context.Context, server *musterv1alpha1.MCPServer) error

UpdateMCPServerStatus rewrites the entire YAML — filesystem mode embeds status alongside spec, so there is no separate status sub-resource.

func (*Client) UpdateWorkflow

func (f *Client) UpdateWorkflow(_ context.Context, w *musterv1alpha1.Workflow) error

func (*Client) UpdateWorkflowStatus

func (f *Client) UpdateWorkflowStatus(ctx context.Context, w *musterv1alpha1.Workflow) error

UpdateWorkflowStatus rewrites the entire YAML — filesystem mode embeds status alongside spec, so there is no separate status sub-resource.

func (*Client) WatchEvents added in v0.14.1

func (f *Client) WatchEvents(ctx context.Context, options api.EventQueryOptions) (<-chan api.EventResult, error)

WatchEvents streams events matching the options as they are written, using an fsnotify watch on the events directory. On each filesystem change it reads the JSON daily files and emits events newer than the last one delivered. The returned channel is closed when ctx is cancelled. This is event-driven (no timer polling): work happens only when the on-disk log actually changes.

Jump to

Keyboard shortcuts

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