config

package
v0.0.0-...-1377e06 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PresetDisabled     = "disabled"
	PresetConservative = "conservative"
	PresetBalanced     = "balanced"
	PresetPerformance  = "performance"
	PresetAggressive   = "aggressive"

	EnvServerWorkerAmount        = "SERVER_WORKER_AMOUNT"
	EnvServerThreadsAmount       = "SERVER_THREADS_AMOUNT"
	EnvServerWorkerClass         = "SERVER_WORKER_CLASS"
	EnvGunicornTimeout           = "GUNICORN_TIMEOUT"
	EnvGunicornKeepAlive         = "GUNICORN_KEEPALIVE"
	EnvWorkerMaxRequests         = "WORKER_MAX_REQUESTS"
	EnvWorkerMaxRequestsJitter   = "WORKER_MAX_REQUESTS_JITTER"
	EnvServerLimitRequestLine    = "SERVER_LIMIT_REQUEST_LINE"
	EnvServerLimitRequestFieldSz = "SERVER_LIMIT_REQUEST_FIELD_SIZE"
	EnvGunicornLogLevel          = "GUNICORN_LOGLEVEL"
)
View Source
const (
	ComponentWebServer       = common.ComponentWebServer
	ComponentCeleryWorker    = common.ComponentCeleryWorker
	ComponentCeleryBeat      = common.ComponentCeleryBeat
	ComponentCeleryFlower    = common.ComponentCeleryFlower
	ComponentWebsocketServer = common.ComponentWebsocketServer
	ComponentMcpServer       = common.ComponentMcpServer
	ComponentInit            = common.ComponentInit
)

Component type constants re-exported for convenience.

Variables

This section is empty.

Functions

func RenderConfig

func RenderConfig(componentType ComponentType, input *ConfigInput) string

RenderConfig generates the superset_config.py content for a given component type. Returns empty string for ComponentWebsocketServer (Node.js, no Python config).

Types

type ComponentType

type ComponentType = common.ComponentType

ComponentType is an alias for common.ComponentType.

type ConfigInput

type ConfigInput struct {
	// Metastore mode and driver.
	MetastoreMode MetastoreMode
	// DBDriver is the database driver for structured mode (e.g. "postgresql", "mysql").
	DBDriver string

	// Valkey cache configuration. Nil when spec.valkey is not set.
	Valkey *ValkeyInput

	// Engine options for SQLALCHEMY_ENGINE_OPTIONS. Nil = do not render.
	EngineOptions *EngineOptionsInput

	// Top-level raw Python from spec.config.
	Config string

	// Per-component raw Python from component.config.
	ComponentConfig string
}

ConfigInput holds the simplified config fields needed to render superset_config.py.

type EngineOptionsInput

type EngineOptionsInput struct {
	UseNullPool bool
	PoolSize    int32
	MaxOverflow int32
	PoolRecycle int32
	PoolPrePing bool
	PoolTimeout int32
}

EngineOptionsInput holds resolved SQLALCHEMY_ENGINE_OPTIONS for rendering. A nil value from ComputeEngineOptions means the section should not be rendered.

func ComputeEngineOptions

func ComputeEngineOptions(
	componentType common.ComponentType,
	topLevel *v1alpha1.SQLAlchemyEngineOptionsSpec,
	perComponent *v1alpha1.SQLAlchemyEngineOptionsSpec,
	workers, threads int32,
) *EngineOptionsInput

ComputeEngineOptions computes the SQLALCHEMY_ENGINE_OPTIONS for a given component. Returns nil when the effective preset is "disabled".

The effective spec is resolved as: perComponent > topLevel > nil (balanced default). Workers and threads come from the resolved gunicorn/celery configuration and are used to compute pool sizes for the performance and aggressive presets.

type MetastoreMode

type MetastoreMode int

MetastoreMode controls how the SQLALCHEMY_DATABASE_URI is rendered.

const (
	// MetastoreNone means no metastore config rendered — user handles DB via
	// raw Python config.
	MetastoreNone MetastoreMode = iota
	// MetastorePassthrough means a full URI was provided — renders a simple
	// assignment from an operator-internal env var.
	MetastorePassthrough
	// MetastoreStructured means structured fields were set — renders f-string
	// URI from operator-internal env vars.
	MetastoreStructured
)

type ResolvedCelery

type ResolvedCelery struct {
	Disabled           bool
	Concurrency        int32
	Pool               string
	Optimization       string
	MaxTasksPerChild   int32
	MaxMemoryPerChild  int32
	PrefetchMultiplier int32
	SoftTimeLimit      int32
	TimeLimit          int32
}

ResolvedCelery holds fully-resolved Celery worker parameters.

func ResolveCelery

func ResolveCelery(spec *v1alpha1.CeleryWorkerProcessSpec) ResolvedCelery

ResolveCelery resolves a CeleryWorkerProcessSpec into concrete values. When spec is nil, balanced defaults are used.

func (*ResolvedCelery) Command

func (c *ResolvedCelery) Command() []string

Command returns the celery worker command args.

type ResolvedGunicorn

type ResolvedGunicorn struct {
	Disabled              bool
	Workers               int32
	Threads               int32
	WorkerClass           string
	Timeout               int32
	KeepAlive             int32
	MaxRequests           int32
	MaxRequestsJitter     int32
	LimitRequestLine      int32
	LimitRequestFieldSize int32
	LogLevel              string
}

ResolvedGunicorn holds fully-resolved Gunicorn parameters.

func ResolveGunicorn

func ResolveGunicorn(spec *v1alpha1.GunicornSpec) ResolvedGunicorn

ResolveGunicorn resolves a GunicornSpec into concrete values. When spec is nil, balanced defaults are used.

func (*ResolvedGunicorn) EnvVars

func (g *ResolvedGunicorn) EnvVars() []corev1.EnvVar

EnvVars returns the Gunicorn env vars for injection into the web server container.

type ValkeyCacheInput

type ValkeyCacheInput struct {
	Disabled       bool
	Database       int32
	KeyPrefix      string
	DefaultTimeout int32
}

ValkeyCacheInput holds resolved settings for a Flask-Caching section.

type ValkeyCeleryInput

type ValkeyCeleryInput struct {
	Disabled bool
	Database int32
}

ValkeyCeleryInput holds resolved settings for a Celery Valkey backend.

type ValkeyInput

type ValkeyInput struct {
	SSL             bool
	SSLCertRequired string
	SSLKeyFile      string
	SSLCertFile     string
	SSLCACertFile   string

	Cache                ValkeyCacheInput
	DataCache            ValkeyCacheInput
	FilterStateCache     ValkeyCacheInput
	ExploreFormDataCache ValkeyCacheInput
	ThumbnailCache       ValkeyCacheInput
	CeleryBroker         ValkeyCeleryInput
	CeleryResultBackend  ValkeyCeleryInput
	ResultsBackend       ValkeyResultsInput
}

ValkeyInput holds all resolved Valkey configuration for config rendering.

type ValkeyResultsInput

type ValkeyResultsInput struct {
	Disabled  bool
	Database  int32
	KeyPrefix string
}

ValkeyResultsInput holds resolved settings for the SQL Lab results backend.

Jump to

Keyboard shortcuts

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