provision

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 15 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrokerURL

func BrokerURL(ctx context.Context, cfg *rest.Config, namespace string) string

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

func EnsureNamespace(ctx context.Context, cfg *rest.Config, namespace string) error

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

func SanitizeResourceName(s string) string

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

func NewClient(cfg *rest.Config, namespace string, debug io.Writer) (*Client, error)

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

func (c *Client) InstallBroker(ctx context.Context) error

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

func (c *Client) InstallCRDs(ctx context.Context) error

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) (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

func (c *Client) InstallOTEL(ctx context.Context) error

InstallOTEL installs the trace collector.

Jump to

Keyboard shortcuts

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