helm

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package helm provides Go structs for Helm chart values with validation support. These structs mirror the structure of helm/stats-agent-team/values.yaml and can be used for programmatic validation, testing, and generation of Helm values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentConfig

type AgentConfig struct {
	Enabled      bool              `yaml:"enabled"`
	ReplicaCount int               `yaml:"replicaCount" validate:"omitempty,min=0,max=100"`
	Image        AgentImageConfig  `yaml:"image"`
	Service      ServiceConfig     `yaml:"service"`
	Resources    ResourcesConfig   `yaml:"resources"`
	Autoscaling  AutoscalingConfig `yaml:"autoscaling"`
	PDB          PDBConfig         `yaml:"pdb"`
	NodeSelector map[string]string `yaml:"nodeSelector"`
	Tolerations  []Toleration      `yaml:"tolerations"`
	Affinity     map[string]any    `yaml:"affinity"`
}

AgentConfig defines configuration for an individual agent.

type AgentImageConfig

type AgentImageConfig struct {
	Repository string `yaml:"repository"` // Not required in overlays
	Tag        string `yaml:"tag"`
}

AgentImageConfig defines agent-specific image settings.

type AutoscalingBehavior

type AutoscalingBehavior struct {
	ScaleDown *ScalingRules `yaml:"scaleDown,omitempty"`
	ScaleUp   *ScalingRules `yaml:"scaleUp,omitempty"`
}

AutoscalingBehavior defines scaling behavior policies.

type AutoscalingConfig

type AutoscalingConfig struct {
	Enabled                           bool                 `yaml:"enabled"`
	MinReplicas                       int                  `yaml:"minReplicas" validate:"omitempty,min=1"`
	MaxReplicas                       int                  `yaml:"maxReplicas" validate:"omitempty,min=1,max=1000"`
	TargetCPUUtilizationPercentage    int                  `yaml:"targetCPUUtilizationPercentage" validate:"omitempty,min=1,max=100"`
	TargetMemoryUtilizationPercentage int                  `yaml:"targetMemoryUtilizationPercentage" validate:"omitempty,min=1,max=100"`
	Behavior                          *AutoscalingBehavior `yaml:"behavior,omitempty"`
}

AutoscalingConfig defines Horizontal Pod Autoscaler settings.

type Capabilities

type Capabilities struct {
	Add  []string `yaml:"add"`
	Drop []string `yaml:"drop"`
}

Capabilities defines Linux capabilities settings.

type GlobalConfig

type GlobalConfig struct {
	Image            ImageConfig       `yaml:"image" validate:"required"`
	ImagePullSecrets []ImagePullSecret `yaml:"imagePullSecrets"`
}

GlobalConfig contains global settings for all agents.

type ImageConfig

type ImageConfig struct {
	Registry   string `yaml:"registry"`
	Repository string `yaml:"repository"`
	PullPolicy string `yaml:"pullPolicy" validate:"omitempty,oneof=Always IfNotPresent Never"`
	Tag        string `yaml:"tag" validate:"required"`
}

ImageConfig defines container image settings.

type ImagePullSecret

type ImagePullSecret struct {
	Name string `yaml:"name" validate:"required"`
}

ImagePullSecret references a Kubernetes secret for pulling images.

type IngressConfig

type IngressConfig struct {
	Enabled     bool              `yaml:"enabled"`
	ClassName   string            `yaml:"className"`
	Annotations map[string]string `yaml:"annotations"`
	Host        string            `yaml:"host" validate:"omitempty,hostname|fqdn"`
	TLS         []IngressTLS      `yaml:"tls"`
}

IngressConfig defines Kubernetes ingress settings.

type IngressTLS

type IngressTLS struct {
	SecretName string   `yaml:"secretName" validate:"required"`
	Hosts      []string `yaml:"hosts" validate:"required,min=1,dive,hostname|fqdn"`
}

IngressTLS defines TLS configuration for ingress.

type LLMConfig

type LLMConfig struct {
	Provider    string `yaml:"provider" validate:"required,oneof=gemini claude openai ollama"`
	BaseURL     string `yaml:"baseUrl"`
	GeminiModel string `yaml:"geminiModel"`
	ClaudeModel string `yaml:"claudeModel"`
	OpenAIModel string `yaml:"openaiModel"`
	OllamaModel string `yaml:"ollamaModel"`
	OllamaURL   string `yaml:"ollamaUrl" validate:"omitempty,url"`
}

LLMConfig contains LLM provider configuration.

type NamespaceConfig

type NamespaceConfig struct {
	Create bool   `yaml:"create"`
	Name   string `yaml:"name" validate:"required,min=1,max=63"`
}

NamespaceConfig defines Kubernetes namespace settings.

type OrchestrationConfig

type OrchestrationConfig struct {
	AgentConfig `yaml:",inline"`
	UseEino     bool `yaml:"useEino"`
}

OrchestrationConfig extends AgentConfig with orchestration-specific settings.

type PDBConfig

type PDBConfig struct {
	Enabled        bool   `yaml:"enabled"`
	MinAvailable   string `yaml:"minAvailable,omitempty"`   // Can be int or percentage string
	MaxUnavailable string `yaml:"maxUnavailable,omitempty"` // Can be int or percentage string
}

PDBConfig defines Pod Disruption Budget settings.

type PodSecurityContext

type PodSecurityContext struct {
	RunAsNonRoot bool  `yaml:"runAsNonRoot"`
	RunAsUser    int64 `yaml:"runAsUser" validate:"omitempty,min=0"`
	RunAsGroup   int64 `yaml:"runAsGroup" validate:"omitempty,min=0"`
	FSGroup      int64 `yaml:"fsGroup" validate:"omitempty,min=0"`
}

PodSecurityContext defines pod-level security settings.

type ResourceSpec

type ResourceSpec struct {
	CPU    string `yaml:"cpu" validate:"omitempty,k8s_resource_quantity"`
	Memory string `yaml:"memory" validate:"omitempty,k8s_resource_quantity"`
}

ResourceSpec defines CPU and memory specifications.

type ResourcesConfig

type ResourcesConfig struct {
	Requests ResourceSpec `yaml:"requests"`
	Limits   ResourceSpec `yaml:"limits"`
}

ResourcesConfig defines Kubernetes resource requests and limits.

type ScalingPolicy

type ScalingPolicy struct {
	Type          string `yaml:"type" validate:"required,oneof=Pods Percent"`
	Value         int    `yaml:"value" validate:"required,min=1"`
	PeriodSeconds int    `yaml:"periodSeconds" validate:"required,min=1,max=1800"`
}

ScalingPolicy defines a single scaling policy.

type ScalingRules

type ScalingRules struct {
	StabilizationWindowSeconds int             `yaml:"stabilizationWindowSeconds,omitempty" validate:"omitempty,min=0,max=3600"`
	Policies                   []ScalingPolicy `yaml:"policies,omitempty"`
	SelectPolicy               string          `yaml:"selectPolicy,omitempty" validate:"omitempty,oneof=Max Min Disabled"`
}

ScalingRules defines scaling stabilization and policies.

type SearchConfig

type SearchConfig struct {
	Provider string `yaml:"provider" validate:"required,oneof=serper serpapi"`
}

SearchConfig contains search provider configuration.

type SecretsConfig

type SecretsConfig struct {
	Create          bool   `yaml:"create"`
	GeminiAPIKey    string `yaml:"geminiApiKey"`
	ClaudeAPIKey    string `yaml:"claudeApiKey"`
	OpenAIAPIKey    string `yaml:"openaiApiKey"`
	AnthropicAPIKey string `yaml:"anthropicApiKey"`
	SerperAPIKey    string `yaml:"serperApiKey"`
	SerpAPIKey      string `yaml:"serpApiKey"`
}

SecretsConfig defines API key secrets.

type SecurityContext

type SecurityContext struct {
	AllowPrivilegeEscalation bool         `yaml:"allowPrivilegeEscalation"`
	ReadOnlyRootFilesystem   bool         `yaml:"readOnlyRootFilesystem"`
	Capabilities             Capabilities `yaml:"capabilities"`
}

SecurityContext defines container-level security settings.

type ServiceAccountConfig

type ServiceAccountConfig struct {
	Create      bool              `yaml:"create"`
	Annotations map[string]string `yaml:"annotations"`
	Name        string            `yaml:"name"`
}

ServiceAccountConfig defines Kubernetes service account settings.

type ServiceConfig

type ServiceConfig struct {
	Type    string `yaml:"type" validate:"omitempty,oneof=ClusterIP NodePort LoadBalancer"`
	Port    int    `yaml:"port" validate:"omitempty,min=1,max=65535"`
	A2APort int    `yaml:"a2aPort" validate:"omitempty,min=1,max=65535"`
}

ServiceConfig defines Kubernetes service settings.

type Toleration

type Toleration struct {
	Key               string `yaml:"key"`
	Operator          string `yaml:"operator" validate:"omitempty,oneof=Exists Equal"`
	Value             string `yaml:"value"`
	Effect            string `yaml:"effect" validate:"omitempty,oneof=NoSchedule PreferNoSchedule NoExecute"`
	TolerationSeconds *int64 `yaml:"tolerationSeconds"`
}

Toleration defines a Kubernetes pod toleration.

type Validator

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

Validator provides validation for Helm values.

func NewValidator

func NewValidator() *Validator

NewValidator creates a new Validator with custom validation rules.

func (*Validator) Validate

func (v *Validator) Validate(values *Values) error

Validate validates the given Values struct.

func (*Validator) ValidateWithContext

func (v *Validator) ValidateWithContext(values *Values) []error

ValidateWithContext performs validation with additional business logic checks.

type Values

type Values struct {
	Global             GlobalConfig         `yaml:"global" validate:"required"`
	Namespace          NamespaceConfig      `yaml:"namespace" validate:"required"`
	LLM                LLMConfig            `yaml:"llm" validate:"required"`
	Search             SearchConfig         `yaml:"search" validate:"required"`
	Secrets            SecretsConfig        `yaml:"secrets"`
	Research           AgentConfig          `yaml:"research" validate:"required"`
	Synthesis          AgentConfig          `yaml:"synthesis" validate:"required"`
	Verification       AgentConfig          `yaml:"verification" validate:"required"`
	Orchestration      OrchestrationConfig  `yaml:"orchestration" validate:"required"`
	Direct             AgentConfig          `yaml:"direct"`
	Ingress            IngressConfig        `yaml:"ingress"`
	ServiceAccount     ServiceAccountConfig `yaml:"serviceAccount"`
	PodSecurityContext PodSecurityContext   `yaml:"podSecurityContext"`
	SecurityContext    SecurityContext      `yaml:"securityContext"`
}

Values represents the complete Helm chart values structure.

func LoadAndMerge

func LoadAndMerge(basePath, overlayPath string) (*Values, error)

LoadAndMerge loads a base values file and merges it with an overlay file. This mimics how Helm merges values files.

func LoadAndValidate

func LoadAndValidate(path string) (*Values, []error)

LoadAndValidate loads a values file and validates it.

func LoadMergeAndValidate

func LoadMergeAndValidate(basePath, overlayPath string) (*Values, []error)

LoadMergeAndValidate loads a base values file, merges it with an overlay, and validates the result.

func LoadValuesFile

func LoadValuesFile(path string) (*Values, error)

LoadValuesFile loads and parses a values YAML file.

func ParseValues

func ParseValues(data []byte) (*Values, error)

ParseValues parses YAML data into a Values struct.

Jump to

Keyboard shortcuts

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