ecosystem

package
v0.0.0-...-abaeddd Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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.

View Source
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

func New(e *spec.Ecosystem, password func() string) (*Plan, error)

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

func (p *Plan) Context() map[string]string

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

func (p *Plan) Data() map[string]any

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

func (p *Plan) WriteSecrets(ctx context.Context, cs kubernetes.Interface) ([]Undo, error)

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 Secrets

type Secrets []Secret

Secrets are Secrets 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.

type Wait

type Wait struct {
	Kind, Name, Namespace, Condition string
}

Wait is a resource the ecosystem waits on: until its condition is True.

type Waits

type Waits []Wait

Waits are resources to wait on, in order.

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.

Jump to

Keyboard shortcuts

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