Documentation
¶
Overview ¶
Package ecosystem installs the data services a jig declares (environment.ecosystem): the operators they need, the data-services chart with values built from the declaration, and the Secrets that carry each service's connection details to the workload.
Names and addresses are fixed, one instance per service named for it, and jig generates every password, so the connection details are known before anything is installed: nothing is read back from the cluster.
Each data service is one implementation (postgres.go, mariadb.go, …); New runs them all, then writes the Secrets.
Index ¶
Constants ¶
const ( DefaultChart = "oci://ghcr.io/rollwright/charts/data-services" DefaultChartVersion = "0.4.0" )
The data-services chart jig installs by default, pinned per jig release.
const ( Postgres = "postgres" Mariadb = "mariadb" Rabbitmq = "rabbitmq" Redis = "redis" Kafka = "kafka" )
The services. Their order is only for stable output (the same plan, operators and export keys every run): no service depends on another.
const (
DefaultNamespace = "data"
)
Defaults for what a declaration leaves out.
Variables ¶
Services are the services the ecosystem knows, in order.
Functions ¶
func Password ¶
func Password() string
Password returns a new random password: 24 characters from [a-zA-Z0-9] (KEL's randomAlphanumeric), which a URL and a shell carry as they are, so a connection URL needs no escaping.
func Placeholder ¶
func Placeholder() string
Placeholder is the password a plan shows offline: validate builds the plan with it, so every reference resolves and no value is invented.
Types ¶
type InstallOptions ¶
type InstallOptions struct {
// Chart is an oci:// reference or a local chart directory (for chart
// work); DefaultChart when empty.
Chart string
// Version pins an oci:// chart; DefaultChartVersion with DefaultChart,
// ignored for a local directory.
Version string
}
InstallOptions are where the data-services chart comes from.
type Plan ¶
type Plan struct {
// Namespaces are the namespaces the instances and Secrets need.
Namespaces []string
// Operators the declared services need, in install order.
Operators operator.Operators
// Credentials are the password Secrets the chart's entries name, written
// before the chart is installed.
Credentials Secrets
// Values are the data-services chart's values, by service.
Values map[string]any
// Ready are the instances to wait on after the chart is installed.
Ready Waits
// Conns are each declared service's connection details, by field.
Conns map[string]map[string]string
// Outputs are the export and define Secrets, written last.
Outputs Secrets
}
Plan is what installing an ecosystem does, worked out without a cluster.
func New ¶
New works out the plan for e: each declared service's part, the operators they need, then the Secrets. password generates a password where the declaration sets none.
func (*Plan) Context ¶
Context returns every declared service's connection details keyed tool.field (postgres.url, kafka.bootstrap): the ecosystem context, as ${{ ecosystem.postgres.url }} reads it.
func (*Plan) Data ¶
Data returns the connection details by service, then field: what templates ({{ .ecosystem.postgres.url }}) and CEL read under ecosystem.
func (*Plan) Install ¶
func (p *Plan) Install(ctx context.Context, cs kubernetes.Interface, o InstallOptions) ([]Undo, error)
Install installs what the plan declares, in order: the operators the services need (one already running is used as it is, and left alone), the Secrets (credentials, then export and define), the data-services chart with the plan's values, then each instance's readiness. It returns what it did, in order, for the caller to undo in reverse, including what it did before an error.
func (*Plan) WriteSecrets ¶
WriteSecrets writes the plan's Secrets: the credentials the chart's entries name, then the export and define Secrets, each created or its keys updated. A namespace they or the instances need is created when it is missing. It returns what it did, in order, for the caller to undo in reverse: a namespace only when it created it, so one that was there stays.
type Secret ¶
type Secret struct {
Name, Namespace string
Type string // "" is Opaque
Labels map[string]string
Data map[string]string
}
Secret is a Secret the ecosystem writes.
type Undo ¶
type Undo struct {
// Label names it, such as "Secret shop/shop-deps".
Label string
Do func(context.Context) error
}
Undo is one thing WriteSecrets did, and how to undo it.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package operator installs the Kubernetes operators jig's data services need: each a Helm chart or a release manifest, pinned per jig release.
|
Package operator installs the Kubernetes operators jig's data services need: each a Helm chart or a release manifest, pinned per jig release. |