Documentation
¶
Overview ¶
Package provision installs the Tiny Systems runtime and capability modules onto a cluster by embedding the Helm Go SDK (via mittwald's go-helm-client) — no shelling out to a `helm` binary, no hosted platform.
A full runtime is four helm releases from the public chart repo https://tiny-systems.github.io/module/:
tinysystems-crd CRDs (TinyModule/TinyNode/TinyFlow/…) tinysystems-nats NATS/JetStream broker — durable transport + run ledger tinysystems-otel-collector trace collector tinysystems-operator the module itself (one release per module, image-parameterised)
The sequence and module values mirror the platform's install job so a `tiny`-provisioned cluster behaves identically to a hosted one — minus the multi-tenant machinery (no DB, no job locks, one namespace, one owner).
Index ¶
- func BaseValues(image, release, version, namespace, natsURL string) map[string]any
- func BrokerURL(ctx context.Context, cfg *rest.Config, namespace string) string
- func EnsureNamespace(ctx context.Context, cfg *rest.Config, namespace string) error
- func SanitizeResourceName(s string) string
- func SaveSettings(ctx context.Context, cfg *rest.Config, namespace string, s Settings) error
- type Client
- func (c *Client) InstallBroker(ctx context.Context) error
- func (c *Client) InstallCRDs(ctx context.Context) error
- func (c *Client) InstallModule(ctx context.Context, m *catalog.Module, natsURL string, settings Settings) (string, error)
- func (c *Client) InstallOTEL(ctx context.Context) error
- func (c *Client) Lookup(_ context.Context, _, release string) (string, bool, error)
- func (c *Client) UpgradeInstall(ctx context.Context, release, namespace, chart, version string, ...) error
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseValues ¶
BaseValues builds the harness (operator-chart) values that every module install needs regardless of the module — the plumbing `moduleValues` constructs today, re-expressed as a nested values map derived from the install plan instead of the old catalog. The module's own values.yaml overlay (rbac / ingress / storage) is merged on top of this by the caller.
`release` doubles as the operator's identity (`--name`): it is the coexistence-safe `<module>-v<major>` release name, so two majors of a module register as distinct operators in one namespace and their TinyNodes bind to the right one. (This replaces today's workspace-qualified `tinysystems/http-module-v0` identity.)
func BrokerURL ¶
BrokerURL returns the authenticated broker URL clients connect with — nats://<token>@tinysystems-nats.<ns>.svc:4222 — reading the token the nats chart generated into its auth secret. Falls back to the tokenless URL (never errors) when the secret is absent: a pre-auth broker or a transient read still connects, so auth degrades gracefully instead of hard-failing.
func EnsureNamespace ¶
EnsureNamespace creates the target namespace if absent and labels it tinysystems.io/managed=true — the dedication marker the operator chart's pre-install hook requires. Must run before any module install. Idempotent: on an already-labeled namespace it's a single read.
func SanitizeResourceName ¶
SanitizeResourceName lowercases and reduces an arbitrary name to a valid RFC-1123 helm release / resource name: [a-z0-9-], no leading/trailing dash, capped at 53 chars. "tinysystems/http-module-v0" → "tinysystems-http-module-v0".
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a helm client bound to one cluster + namespace, with the tinysystems chart repo already added.
func NewClient ¶
NewClient builds a helm client against cfg/namespace and registers the public chart repo. Pass a non-nil debug writer to surface helm's own (verbose) log; nil keeps installs quiet.
func (*Client) InstallBroker ¶
InstallBroker installs the NATS/JetStream broker. Deliberately no Force: the broker is a StatefulSet holding the durable run ledger, and forcing a replace would risk its persistent state.
func (*Client) InstallCRDs ¶
InstallCRDs installs the CRD chart. Cluster-scoped resources, but the release lives in the target namespace (single-owner cluster — none of the multi-tenant CRD-ownership dance the platform needs).
func (*Client) InstallModule ¶
func (c *Client) InstallModule(ctx context.Context, m *catalog.Module, natsURL string, settings Settings) (string, error)
InstallModule installs one capability module as a tinysystems-operator release parameterised by the module's image. Returns the helm release name. natsURL wires the broker so durable execution is on out of the box; pass "" to leave the module in blocking-only mode.
func (*Client) InstallOTEL ¶
InstallOTEL installs the trace collector.
func (*Client) Lookup ¶ added in v0.4.41
Lookup reports the module image ref of whatever occupies a helm release name, or found=false when the release isn't installed.
It satisfies repo.InstalledModules structurally — primitives only, so this package still does not import internal/repo, matching how BaseValues and UpgradeInstall are wired.
The image is the authoritative identity of an installed release: it is literally what the pod runs, so it distinguishes two publishers shipping the same module name without needing any extra bookkeeping.
A release that isn't installed is not an error — that is the normal case on a fresh cluster, and helm reports it as one.
func (*Client) UpgradeInstall ¶
func (c *Client) UpgradeInstall(ctx context.Context, release, namespace, chart, version string, vals map[string]any) error
UpgradeInstall installs or upgrades an arbitrary chart with a full values map — the generic helm primitive the repo-model installer drives. It makes *Client structurally satisfy repo.Helm (no import of the repo package needed; Go interfaces are structural). Mirrors the install flags used elsewhere (create-namespace, wait, atomic, cleanup-on-fail). Nothing calls it until the install/up cutover; adding it is non-breaking.
type Settings ¶
type Settings struct {
IngressClass string
DomainSuffix string
StorageClass string
StorageSize string // default 1Gi when a module needs storage
// Issuer is the cert-manager (Cluster)Issuer name to annotate ingresses
// with for TLS; ClusterIssuer selects cluster-issuer vs namespace issuer.
Issuer string
ClusterIssuer bool
}
Settings are cluster-wide install values — properties of YOUR cluster, not of any one module: which ingress controller, the base domain, the storage class. They're persisted as annotations on the tinysystems namespace, so they travel with the cluster and every module install reads them. Set them once (flags on `tiny up`/`tiny install`); modules that need them pick them up.
func LoadSettings ¶
LoadSettings reads the saved cluster settings off the namespace annotations.