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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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
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