memory-bank/components/ws-daemon.md
The Workspace Daemon (ws-daemon) is a critical component that runs on each Kubernetes node in the Gitpod cluster. It manages workspace-related operations at the node level, including workspace initialization, content synchronization, backup, and resource management.
The primary purposes of the Workspace Daemon are:
The Workspace Daemon operates as a node-level daemon with several key components:
The daemon runs with elevated privileges on each node to perform operations that require system-level access, such as managing LVM volumes, enforcing disk quotas, and accessing workspace filesystems.
main.go: Entry point that calls the Execute function from the cmd packagecmd/root.go: Defines the root command and basic service configurationcmd/run.go: Implements the main daemon servicecmd/client*.go: Client commands for interacting with the daemonpkg/daemon/: Core daemon implementationpkg/content/: Workspace content managementnsinsider/: Namespace operations helpercomponents/common-go:lib: Common Go utilitiescomponents/content-service-api/go:lib: Content service API definitionscomponents/content-service:lib: Content service clientcomponents/ws-daemon-api/go:lib: Workspace daemon API definitionscomponents/ws-manager-api/go:lib: Workspace manager API definitionscomponents/ws-manager-mk2:crd: Workspace manager custom resource definitionsThe Workspace Daemon is configured via a JSON configuration file that includes:
The Workspace Daemon integrates with:
The Workspace Daemon is typically used to:
The Workspace Daemon implements sophisticated resource management: