Documentation
¶
Overview ¶
Package bootstrap generates the one-click DP-node deployment artifacts: the shell install script and the docker-compose.yml that the Control Plane serves against a single-use enrollment token. Extracted from package main per ADR-0002 as a pure stdlib leaf: the HTTP handlers (token validation against the cluster store, CP address derivation from cluster state) stay in main; this package owns the templates, the image-reference resolution, and the pure request-derivation helpers — with main's trustForwardedHeaders global passed IN as a parameter.
Index ¶
- Constants
- func BaseURL(r *http.Request, trustForwarded bool) string
- func EnrollmentAddr(r *http.Request, grpcListenAddr string, trustForwarded bool) string
- func ExtractToken(path, prefix string) string
- func Image(settingsPath, version string) string
- func RenderCompose(w io.Writer, image, enrollURL string) error
- func RenderScript(w io.Writer, cpHost, cpBase, token string) error
Constants ¶
const DefaultImage = "ghcr.io/kidcarmi/culvert"
DefaultImage is the default container image; overridden by registry settings.
Variables ¶
This section is empty.
Functions ¶
func BaseURL ¶
BaseURL derives the CP's external base URL from the incoming request. trustForwarded is main's trustForwardedHeaders setting, passed in so the package stays free of main's globals.
func EnrollmentAddr ¶
EnrollmentAddr derives the gRPC Control Plane address for the enrollment URL. Uses the HTTP request's host (the IP/hostname the admin used to access the UI) combined with the gRPC port from the configured listen address. IPv6-safe: strips brackets before net.JoinHostPort to prevent double-bracketing.
func ExtractToken ¶
ExtractToken extracts the token segment from a bootstrap URL path. For /api/cluster/bootstrap/abc123 → "abc123" For /api/cluster/bootstrap/abc123/compose → "abc123"
func Image ¶
Image returns the image reference for DP nodes, checking registry settings first, falling back to the default ghcr.io image with the current version.
func RenderCompose ¶
RenderCompose writes the docker-compose.yml for the given image ref and enrollment URL.
Types ¶
This section is empty.