stack

package
v0.9.31 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 7 Imported by: 1 module, 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

Index

Constants

View Source
const (
	// DefaultStackFile is the default name for stack configuration
	DefaultStackFile = "weave-stack.yaml"

	// DefaultStateDir is the directory for stack state
	DefaultStateDir = ".weave-state"
)

Variables

This section is empty.

Functions

func DeleteCluster

func DeleteCluster(info *ClusterInfo) error

DeleteCluster deletes the cluster based on provider

func GenerateHelmChart

func GenerateHelmChart(config *StackConfig, outputDir string) error

GenerateHelmChart generates complete Helm chart from StackConfig

func GetClusterStatus

func GetClusterStatus(info *ClusterInfo) (string, error)

GetClusterStatus gets the current status of the cluster

func GetRuntimeVersion

func GetRuntimeVersion(runtime ContainerRuntime) (string, error)

GetRuntimeVersion gets the version of a container runtime

func SaveClusterInfo

func SaveClusterInfo(info *ClusterInfo) error

SaveClusterInfo saves cluster information to state directory

func SaveHelmValues

func SaveHelmValues(values *HelmValues, outputPath string) error

SaveHelmValues saves Helm values to a file

func SaveStackConfig

func SaveStackConfig(config *StackConfig, path string) error

SaveStackConfig saves configuration to YAML file

func StackExists

func StackExists() bool

StackExists checks if weave-stack.yaml exists in current directory

func ValidateConfig

func ValidateConfig(config *StackConfig) error

ValidateConfig validates the stack configuration

func ValidateRuntime

func ValidateRuntime(runtime ContainerRuntime) error

ValidateRuntime ensures the specified runtime is available

Types

type APIRoute

type APIRoute struct {
	Path       string   `yaml:"path"`
	Collection string   `yaml:"collection,omitempty"`
	Type       string   `yaml:"type,omitempty"` // "search", "healthcheck"
	Methods    []string `yaml:"methods,omitempty"`
	Auth       string   `yaml:"auth,omitempty"` // "required", "optional", "none"
}

APIRoute defines an API route

type AutoScaling

type AutoScaling struct {
	MinNodeCount int `yaml:"min_node_count"`
	MaxNodeCount int `yaml:"max_node_count"`
}

AutoScaling defines auto-scaling configuration

type BackupConfig

type BackupConfig struct {
	Enabled       bool   `yaml:"enabled"`
	Schedule      string `yaml:"schedule,omitempty"`
	RetentionDays int    `yaml:"retention_days,omitempty"`
}

BackupConfig defines backup configuration

type BuildConfig

type BuildConfig struct {
	Dockerfile string `yaml:"dockerfile,omitempty"`
	Context    string `yaml:"context,omitempty"`
	Target     string `yaml:"target,omitempty"`
	Cache      bool   `yaml:"cache,omitempty"`
}

BuildConfig defines build configuration

type CheckpointConfig

type CheckpointConfig struct {
	Enabled      bool   `yaml:"enabled"`
	Path         string `yaml:"path,omitempty"`
	SaveInterval int    `yaml:"save_interval,omitempty"`
}

CheckpointConfig defines checkpointing

type ChunkingConfig

type ChunkingConfig struct {
	Strategy     string `yaml:"strategy"` // "semantic", "fixed", "sentence"
	ChunkSize    int    `yaml:"chunk_size"`
	ChunkOverlap int    `yaml:"chunk_overlap,omitempty"`
}

ChunkingConfig defines how to chunk documents

type CleanupConfig

type CleanupConfig struct {
	RemoveCheckpointsOnSuccess bool `yaml:"remove_checkpoints_on_success,omitempty"`
	RetainLogsDays             int  `yaml:"retain_logs_days,omitempty"`
	CompressOldLogs            bool `yaml:"compress_old_logs,omitempty"`
}

CleanupConfig defines cleanup policies

type ClusterInfo

type ClusterInfo struct {
	Name             string    `json:"name"`
	Provider         string    `json:"provider"` // "kind", "minikube", "eks", "gke"
	Context          string    `json:"context"`  // kubectl context name
	ContainerRuntime string    `json:"container_runtime"`
	CreatedAt        time.Time `json:"created_at"`
	Status           string    `json:"status"` // "active", "stopped", "error"
}

ClusterInfo stores information about the active cluster

func CreateKindCluster

func CreateKindCluster(config *StackConfig) (*ClusterInfo, error)

CreateKindCluster creates a Kind cluster with the specified configuration

func CreateMinikubeCluster

func CreateMinikubeCluster(config *StackConfig) (*ClusterInfo, error)

CreateMinikubeCluster creates a Minikube cluster with the specified configuration

func LoadClusterInfo

func LoadClusterInfo() (*ClusterInfo, error)

LoadClusterInfo loads cluster information from state directory

type CollectionConfig

type CollectionConfig struct {
	Name        string           `yaml:"name"`
	Type        string           `yaml:"type"` // "text", "image"
	Description string           `yaml:"description,omitempty"`
	Schema      SchemaConfig     `yaml:"schema"`
	Sources     []DataSource     `yaml:"sources"`
	Chunking    *ChunkingConfig  `yaml:"chunking,omitempty"`
	Embedding   *EmbeddingConfig `yaml:"embedding,omitempty"`
}

CollectionConfig defines a data collection

type ContainerRuntime

type ContainerRuntime string

ContainerRuntime represents a container runtime

const (
	RuntimePodman ContainerRuntime = "podman"
	RuntimeDocker ContainerRuntime = "docker"
	RuntimeNone   ContainerRuntime = "none"
)

func DetectContainerRuntime

func DetectContainerRuntime() (ContainerRuntime, error)

DetectContainerRuntime detects which container runtime is available Priority: podman > docker (OSS-first preference)

func GetRuntimeCommand

func GetRuntimeCommand(preferredRuntime string) (ContainerRuntime, error)

GetRuntimeCommand returns the appropriate runtime command based on detection

type DashboardConfig

type DashboardConfig struct {
	Enabled bool          `yaml:"enabled"`
	Type    string        `yaml:"type"` // "web", "cli", "none"
	Web     *WebDashboard `yaml:"web,omitempty"`
}

DashboardConfig defines dashboard configuration

type DashboardState

type DashboardState struct {
	Status string `json:"status"` // "running", "stopped", "error"
	URL    string `json:"url,omitempty"`
	Port   int    `json:"port,omitempty"`
}

DashboardState stores dashboard status

type DataSource

type DataSource struct {
	Pattern string                 `yaml:"pattern"`        // Glob pattern
	Type    string                 `yaml:"type"`           // "pdf", "docx", "txt"
	Mode    string                 `yaml:"mode,omitempty"` // "text-only", "image-extraction"
	Options map[string]interface{} `yaml:"options,omitempty"`
}

DataSource defines where data comes from

type DeploymentConfig

type DeploymentConfig struct {
	Replicas     int    `yaml:"replicas"`
	StorageClass string `yaml:"storage_class"`
	PVCSize      string `yaml:"pvc_size"`
}

DeploymentConfig defines K8s Deployment settings

type DevConfig

type DevConfig struct {
	HotReload bool   `yaml:"hot_reload,omitempty"`
	Port      int    `yaml:"port,omitempty"`
	Command   string `yaml:"command,omitempty"`
}

DevConfig defines development mode configuration

type EKSConfig

type EKSConfig struct {
	Region     string         `yaml:"region"`
	NodeGroups []EKSNodeGroup `yaml:"node_groups"`
}

EKSConfig is AWS EKS configuration

type EKSNodeGroup

type EKSNodeGroup struct {
	Name         string `yaml:"name"`
	InstanceType string `yaml:"instance_type"`
	DesiredSize  int    `yaml:"desired_size"`
	MinSize      int    `yaml:"min_size"`
	MaxSize      int    `yaml:"max_size"`
}

EKSNodeGroup defines an EKS node group

type EmbeddingConfig

type EmbeddingConfig struct {
	Model    string `yaml:"model"`
	Provider string `yaml:"provider"`
}

EmbeddingConfig defines embedding model

type FailedFile

type FailedFile struct {
	File     string `json:"file"`
	Error    string `json:"error"`
	Attempts int    `json:"attempts"`
}

FailedFile represents a failed ingestion attempt

type GKEConfig

type GKEConfig struct {
	Zone      string        `yaml:"zone"`
	NodePools []GKENodePool `yaml:"node_pools"`
}

GKEConfig is GCP GKE configuration

type GKENodePool

type GKENodePool struct {
	Name        string       `yaml:"name"`
	MachineType string       `yaml:"machine_type"`
	NodeCount   int          `yaml:"node_count"`
	AutoScaling *AutoScaling `yaml:"auto_scaling,omitempty"`
}

GKENodePool defines a GKE node pool

type HTTPGetAction

type HTTPGetAction struct {
	Path string `yaml:"path"`
	Port int    `yaml:"port"`
}

HTTPGetAction defines an HTTP GET probe

type HealthCheck

type HealthCheck struct {
	Liveness  *Probe `yaml:"liveness,omitempty"`
	Readiness *Probe `yaml:"readiness,omitempty"`
}

HealthCheck defines health check configuration

type HelmHealthCheck

type HelmHealthCheck struct {
	Liveness  HelmProbe `yaml:"liveness"`
	Readiness HelmProbe `yaml:"readiness"`
}

HelmHealthCheck represents health check configuration

type HelmImageStorage

type HelmImageStorage struct {
	Enabled   bool          `yaml:"enabled"`
	Type      string        `yaml:"type"`
	Replicas  int           `yaml:"replicas"`
	Resources HelmResources `yaml:"resources"`
	Storage   HelmStorage   `yaml:"storage"`
}

HelmImageStorage represents image storage configuration

type HelmProbe

type HelmProbe struct {
	Path                string `yaml:"path"`
	Port                int    `yaml:"port"`
	InitialDelaySeconds int    `yaml:"initialDelaySeconds"`
	PeriodSeconds       int    `yaml:"periodSeconds"`
	FailureThreshold    int    `yaml:"failureThreshold,omitempty"`
}

HelmProbe represents a probe configuration

type HelmResourceLimits

type HelmResourceLimits struct {
	Memory string `yaml:"memory"`
	CPU    string `yaml:"cpu"`
}

HelmResourceLimits represents CPU/memory limits

type HelmResources

type HelmResources struct {
	Requests HelmResourceLimits `yaml:"requests"`
	Limits   HelmResourceLimits `yaml:"limits"`
}

HelmResources represents resource requests/limits

type HelmService

type HelmService struct {
	Type        string `yaml:"type"`
	Port        int    `yaml:"port"`
	MetricsPort int    `yaml:"metricsPort"`
}

HelmService represents service configuration

type HelmStackMeta

type HelmStackMeta struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

HelmStackMeta represents stack metadata

type HelmStorage

type HelmStorage struct {
	Class string `yaml:"class"`
	Size  string `yaml:"size"`
}

HelmStorage represents storage configuration

type HelmValues

type HelmValues struct {
	Stack        HelmStackMeta     `yaml:"stack"`
	VectorDB     HelmVectorDB      `yaml:"vectordb"`
	ImageStorage *HelmImageStorage `yaml:"imageStorage,omitempty"`
}

HelmValues represents the Helm values.yaml structure

func GenerateHelmValues

func GenerateHelmValues(config *StackConfig) (*HelmValues, error)

GenerateHelmValues generates Helm values.yaml from StackConfig

type HelmVectorDB

type HelmVectorDB struct {
	Type      string          `yaml:"type"`
	Version   string          `yaml:"version"`
	Replicas  int             `yaml:"replicas"`
	Resources HelmResources   `yaml:"resources"`
	Storage   HelmStorage     `yaml:"storage"`
	Service   HelmService     `yaml:"service"`
	Health    HelmHealthCheck `yaml:"health"`
}

HelmVectorDB represents VectorDB configuration for Helm

type ImageStorageConfig

type ImageStorageConfig struct {
	Type      string                `yaml:"type"` // "minio", "s3", "local"
	Bucket    string                `yaml:"bucket,omitempty"`
	Endpoint  string                `yaml:"endpoint,omitempty"`
	Resources *ResourceRequirements `yaml:"resources,omitempty"`
}

ImageStorageConfig defines image storage configuration

type InfrastructureConfig

type InfrastructureConfig struct {
	VectorDB     VectorDBConfig      `yaml:"vectordb"`
	LLM          *LLMConfig          `yaml:"llm,omitempty"`
	ImageStorage *ImageStorageConfig `yaml:"image_storage,omitempty"`
}

InfrastructureConfig defines infrastructure components

type IngestionConfig

type IngestionConfig struct {
	ParallelWorkers int               `yaml:"parallel_workers,omitempty"`
	BatchSize       int               `yaml:"batch_size,omitempty"`
	Retry           *RetryConfig      `yaml:"retry,omitempty"`
	Timeout         *TimeoutConfig    `yaml:"timeout,omitempty"`
	Checkpoint      *CheckpointConfig `yaml:"checkpoint,omitempty"`
	Monitoring      *MonitoringConfig `yaml:"monitoring,omitempty"`
	Phases          []PhaseConfig     `yaml:"phases,omitempty"`
}

IngestionConfig defines data ingestion pipeline

type IngestionState

type IngestionState struct {
	Phase          string       `json:"phase"`
	CompletedFiles []string     `json:"completed_files"`
	FailedFiles    []FailedFile `json:"failed_files,omitempty"`
	CurrentFile    string       `json:"current_file,omitempty"`
	Progress       Progress     `json:"progress"`
	StartedAt      time.Time    `json:"started_at"`
	UpdatedAt      time.Time    `json:"updated_at"`
}

IngestionState stores ingestion progress

type KindConfig

type KindConfig struct {
	Name   string `yaml:"name"`
	Nodes  int    `yaml:"nodes"`
	Config string `yaml:"config,omitempty"` // Custom Kind config YAML
}

KindConfig is Kind-specific configuration

type KubernetesConfig

type KubernetesConfig struct {
	Provider string          `yaml:"provider"` // "kind", "minikube", "eks", "gke"
	Kind     *KindConfig     `yaml:"kind,omitempty"`
	Minikube *MinikubeConfig `yaml:"minikube,omitempty"`
	EKS      *EKSConfig      `yaml:"eks,omitempty"`
	GKE      *GKEConfig      `yaml:"gke,omitempty"`
}

KubernetesConfig defines K8s cluster configuration

type KubernetesResources

type KubernetesResources struct {
	Deployment DeploymentConfig `yaml:"deployment"`
}

KubernetesResources defines K8s-specific resource configuration

type LLMConfig

type LLMConfig struct {
	Provider string                 `yaml:"provider"` // "openai", "anthropic", "ollama"
	Models   LLMModels              `yaml:"models"`
	Config   map[string]interface{} `yaml:"config,omitempty"`
}

LLMConfig defines LLM provider configuration

type LLMModels

type LLMModels struct {
	Embedding string `yaml:"embedding"`
	Chat      string `yaml:"chat"`
}

LLMModels defines LLM model names

type LogOutput

type LogOutput struct {
	Type string `yaml:"type"` // "file", "stdout"
	Path string `yaml:"path,omitempty"`
}

LogOutput defines a logging output

type LoggingConfig

type LoggingConfig struct {
	Level   string      `yaml:"level"`  // "debug", "info", "warn", "error"
	Format  string      `yaml:"format"` // "text", "json"
	Outputs []LogOutput `yaml:"outputs"`
}

LoggingConfig defines logging settings

type MinikubeConfig

type MinikubeConfig struct {
	Driver string   `yaml:"driver"` // "podman", "docker", "kvm2", "hyperkit"
	CPUs   int      `yaml:"cpus"`
	Memory string   `yaml:"memory"` // e.g., "16384" (MB)
	Addons []string `yaml:"addons,omitempty"`
}

MinikubeConfig is Minikube-specific configuration

type MonitoringConfig

type MonitoringConfig struct {
	VDBHealthCheck  bool   `yaml:"vdb_health_check,omitempty"`
	RestartOnOOM    bool   `yaml:"restart_on_oom,omitempty"`
	MemoryThreshold string `yaml:"memory_threshold,omitempty"`
}

MonitoringConfig defines monitoring settings

type OperationsConfig

type OperationsConfig struct {
	Logging *LoggingConfig `yaml:"logging,omitempty"`
	Cleanup *CleanupConfig `yaml:"cleanup,omitempty"`
	Backup  *BackupConfig  `yaml:"backup,omitempty"`
}

OperationsConfig defines operational settings

type PhaseConfig

type PhaseConfig struct {
	Name                   string   `yaml:"name"`
	Collections            []string `yaml:"collections"`
	Parallel               bool     `yaml:"parallel,omitempty"`
	RestartVDBBetweenFiles bool     `yaml:"restart_vdb_between_files,omitempty"`
}

PhaseConfig defines an ingestion phase

type Probe

type Probe struct {
	HTTPGet             *HTTPGetAction `yaml:"http_get,omitempty"`
	InitialDelaySeconds int            `yaml:"initial_delay_seconds,omitempty"`
	PeriodSeconds       int            `yaml:"period_seconds,omitempty"`
	TimeoutSeconds      int            `yaml:"timeout_seconds,omitempty"`
	FailureThreshold    int            `yaml:"failure_threshold,omitempty"`
}

Probe defines a K8s probe

type Progress

type Progress struct {
	TotalFiles int `json:"total_files"`
	Completed  int `json:"completed"`
	Failed     int `json:"failed"`
	Remaining  int `json:"remaining"`
}

Progress represents ingestion progress

type ResourceLimits

type ResourceLimits struct {
	Memory string `yaml:"memory"`
	CPU    string `yaml:"cpu"`
}

ResourceLimits defines resource limits

type ResourceRequirements

type ResourceRequirements struct {
	Requests ResourceLimits `yaml:"requests"`
	Limits   ResourceLimits `yaml:"limits"`
}

ResourceRequirements defines CPU and memory requirements

type RetryConfig

type RetryConfig struct {
	MaxAttempts int           `yaml:"max_attempts"`
	Backoff     string        `yaml:"backoff"` // "constant", "exponential"
	BaseDelay   time.Duration `yaml:"base_delay,omitempty"`
}

RetryConfig defines retry behavior

type RuntimeConfig

type RuntimeConfig struct {
	Kubernetes       KubernetesConfig `yaml:"kubernetes"`
	ContainerRuntime string           `yaml:"container_runtime"` // "podman" or "docker"
}

RuntimeConfig defines where the stack will run

type SchemaConfig

type SchemaConfig struct {
	VectorDimensions int           `yaml:"vector_dimensions"`
	Fields           []SchemaField `yaml:"fields,omitempty"`
}

SchemaConfig defines collection schema

type SchemaField

type SchemaField struct {
	Name string `yaml:"name"`
	Type string `yaml:"type"` // "string", "int", "float", "text", "bool"
}

SchemaField defines a schema field

type ServiceStatus

type ServiceStatus struct {
	Name      string `json:"name"`
	Status    string `json:"status"` // "running", "stopped", "error"
	Health    string `json:"health"` // "healthy", "unhealthy", "unknown"
	Uptime    string `json:"uptime,omitempty"`
	Resources string `json:"resources,omitempty"`
}

ServiceStatus represents the status of a service

type StackConfig

type StackConfig struct {
	Version        string               `yaml:"version"`
	Name           string               `yaml:"name"`
	Description    string               `yaml:"description,omitempty"`
	Runtime        RuntimeConfig        `yaml:"runtime"`
	Infrastructure InfrastructureConfig `yaml:"infrastructure"`
	Collections    []CollectionConfig   `yaml:"collections,omitempty"`
	Ingestion      *IngestionConfig     `yaml:"ingestion,omitempty"`
	Dashboard      *DashboardConfig     `yaml:"dashboard,omitempty"`
	Operations     *OperationsConfig    `yaml:"operations,omitempty"`
}

StackConfig represents the complete weave-stack.yaml configuration

func LoadStackConfig

func LoadStackConfig(path string) (*StackConfig, error)

LoadStackConfig loads and parses weave-stack.yaml

type StackState

type StackState struct {
	Cluster   *ClusterInfo             `json:"cluster,omitempty"`
	Services  map[string]ServiceStatus `json:"services"`
	Ingestion *IngestionState          `json:"ingestion,omitempty"`
	Dashboard *DashboardState          `json:"dashboard,omitempty"`
	UpdatedAt time.Time                `json:"updated_at"`
}

StackState stores the current state of the stack

type TimeoutConfig

type TimeoutConfig struct {
	PerFile time.Duration `yaml:"per_file,omitempty"`
	Total   time.Duration `yaml:"total,omitempty"`
}

TimeoutConfig defines timeout limits

type VectorDBConfig

type VectorDBConfig struct {
	Type       string                 `yaml:"type"` // "milvus", "qdrant", "weaviate"
	Version    string                 `yaml:"version"`
	Kubernetes *KubernetesResources   `yaml:"kubernetes,omitempty"`
	Resources  ResourceRequirements   `yaml:"resources"`
	Config     map[string]interface{} `yaml:"config,omitempty"`
	Health     *HealthCheck           `yaml:"health,omitempty"`
}

VectorDBConfig defines vector database configuration

type WebDashboard

type WebDashboard struct {
	Framework  string               `yaml:"framework"` // "nextjs", "react", "vue"
	Language   string               `yaml:"language"`  // "typescript", "javascript"
	Version    string               `yaml:"version,omitempty"`
	Kubernetes *KubernetesResources `yaml:"kubernetes,omitempty"`
	Features   []string             `yaml:"features,omitempty"`
	API        []APIRoute           `yaml:"api,omitempty"`
	EnvFile    string               `yaml:"env_file,omitempty"`
	EnvVars    map[string]string    `yaml:"env_vars,omitempty"`
	Build      *BuildConfig         `yaml:"build,omitempty"`
	Dev        *DevConfig           `yaml:"dev,omitempty"`
}

WebDashboard defines web dashboard configuration

Jump to

Keyboard shortcuts

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