config

package
v0.17.6 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package config defines the server configuration structures and the loader that parses, validates, and post-processes the YAML configuration file supplied to the provisioner on startup.

Index

Constants

View Source
const (
	DefaultKubeClientQPS   float32 = 150
	DefaultKubeClientBurst int     = 300
)

Default Kubernetes client-side rate limits, applied when kubeClient.qps or kubeClient.burst is left unset (zero) in the config file. These are hardcoded starting points, not tuned for any particular deployment size — raised from 50/100 after tracing ~24-46ms client-side throttling waits (see rest.Config.QPS/Burst) on Helm release-list cache misses under bursty request load in workspaces-staging.

Variables

View Source
var ClusterDomain string = "cluster.local"

Default cluster domain is "cluster.local", but it can be overridden by configuration. This is needed for constructing the FQDN of workspace pods

Functions

This section is empty.

Types

type BlueprintsFileConfig

type BlueprintsFileConfig struct {
	Directory              string `yaml:"directory" validate:"required"`
	DefaultCustomBlueprint string `yaml:"defaultCustomBlueprint"`
}

Blueprint represents a blueprint configuration

type CertIssuer

type CertIssuer struct {
	Name string `yaml:"name" validate:"required"`
	Kind string `yaml:"kind" validate:"required,oneof=ClusterIssuer Issuer"`
}

CertIssuer represents the certificate issuer configuration

type CertManagerConfig

type CertManagerConfig struct {
	Enabled     bool       `yaml:"enabled"`
	Issuer      CertIssuer `yaml:"issuer" validate:"required_if=Enabled true"`
	Duration    string     `yaml:"duration"`
	RenewBefore string     `yaml:"renewBefore"`
}

CertManagerConfig represents the cert-manager configuration

type Config

type Config struct {
	TargetNamespace     string                  `yaml:"targetNamespace" validate:"required"`
	InjectNamespaces    []string                `yaml:"injectNamespaces"`
	ClusterDomain       string                  `yaml:"clusterDomain"`
	DefaultRegistry     DefaultRegistry         `yaml:"defaultRegistry"`
	PrivateRegistry     PrivateRegistry         `yaml:"privateRegistry"`
	K8shellCapabilities K8shellCapabilities     `yaml:"k8shellCapabilities"`
	CertManager         CertManagerConfig       `yaml:"certManager"`
	GrpcConfig          gapi.ServerConfig       `yaml:"grpc" validate:"required"`
	Nats                ProvisionerNatsConfig   `yaml:"nats"`
	Identity            gapi.ClientConfig       `yaml:"identity"`
	Authz               gapi.ClientConfig       `yaml:"authz"`
	JWTVerifier         authz.JWTVerifierConfig `yaml:"jwtVerifier" validate:"required"`
	Blueprints          BlueprintsFileConfig    `yaml:"blueprints"`
	BaseDir             string                  `yaml:"baseDir"`
	KubeClient          KubeClientConfig        `yaml:"kubeClient"`

	// DB configures the database connection used to persist org-scoped
	// blueprint definitions, layered on top of the file-based blueprints
	// loaded from Blueprints.Directory. Disabled (the default) means org
	// blueprints are unavailable and only file-based blueprints are served.
	DB db.DBConfig `yaml:"db"`
}

Config represents the server configuration

func NewConfig

func NewConfig(configFile string) (*Config, error)

NewConfig loads and fully validates the server configuration from configFile. Post-load steps include: parsing duration strings, applying defaults for cert-manager, validating the JWT signing method, deduplicating injection namespaces, and resolving relative paths against the config file directory.

func (*Config) AllowsInjectionNamespace

func (c *Config) AllowsInjectionNamespace(namespace string) bool

AllowsInjectionNamespace returns true when the namespace is permitted by injectNamespaces. A literal "*" allows all namespaces. Returns false when injectNamespaces is empty, effectively disabling injection.

func (*Config) IsClusterWideInjectionEnabled

func (c *Config) IsClusterWideInjectionEnabled() bool

IsClusterWideInjectionEnabled returns true if injectNamespaces includes "*".

type DefaultRegistry

type DefaultRegistry struct {
	Host string `yaml:"host"`
}

DefaultRegistry is the default container registry host used to prefix image names.

func (DefaultRegistry) ToValues

func (r DefaultRegistry) ToValues() map[string]interface{}

ToValues returns the registry fields as a Helm values map.

type JobsKVConfig

type JobsKVConfig struct {
	ProvisionBucketTTL    time.Duration `yaml:"-"`
	ProvisionBucketTTLRaw string        `yaml:"provisionBucketTTL"`
}

JobsKVConfig represents the configuration for the NATS Key-Value store used for provisioning jobs

type K8shellCapabilities

type K8shellCapabilities struct {
	APIServerEnabled bool             `yaml:"apiServerEnabled"`
	SaToken          k8shelld.SaToken `yaml:"saToken,omitempty"`
	Shells           k8shelld.Shells  `yaml:"shells,omitempty"`
}

K8shellCapabilities represents the capabilities of the k8shell environment

type KubeClientConfig added in v0.16.6

type KubeClientConfig struct {
	QPS   float32 `yaml:"qps"`
	Burst int     `yaml:"burst"`
}

KubeClientConfig tunes the rate limiting of the in-cluster Kubernetes client used for all workspace pod/release lookups and mutations. client-go defaults to 5 QPS / 10 burst when unset, which throttles the provisioner client-side under concurrent request load; DefaultKubeClientQPS and DefaultKubeClientBurst below are applied when the config omits either field.

type PrivateRegistry

type PrivateRegistry struct {
	Host     string `yaml:"host"`
	CertCA   string `yaml:"certCA"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

PrivateRegistry holds credentials for a private registry used to create imagePullSecrets and a registry CA configmap. It is optional — if not set, no regcred is created.

func (PrivateRegistry) ToValues

func (r PrivateRegistry) ToValues() map[string]interface{}

ToValues returns the private registry fields as a Helm values map, including the base64-encoded dockerConfigJson when credentials are configured.

type ProvisionerNatsConfig

type ProvisionerNatsConfig struct {
	natsc.NATSClientConfig `yaml:",inline" mapstructure:",squash"`
	KV                     JobsKVConfig `yaml:"kv" mapstructure:"kv"`
}

ProvisionerNatsConfig represents the NATS configuration for the provisioner

Jump to

Keyboard shortcuts

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