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 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
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
type Settings ¶ added in v0.2.10
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 ¶ added in v0.2.10
LoadSettings reads the saved cluster settings off the namespace annotations.