Documentation
¶
Index ¶
- Constants
- Variables
- func BlueprintApps(bpApps map[string]commonmodels.AppSpec) map[string]*commonmodels.AppSpec
- func ExpandSplash(splash, shellUsername string) string
- func LoadBlueprint(path string) (*commonmodels.Blueprint, error)
- func LoadProfile(path string) (*commonmodels.UserProfile, error)
- type Config
- type SplashVars
Constants ¶
const ( PODMAN_SOCKET_PATH = "/var/run/podman/podman.sock" DOCKER_SOCKET_SYMLINK = "/var/run/docker.sock" BlueprintPath = "/etc/k8shell/blueprint.yaml" ProfilePath = "/etc/k8shell/profile.yaml" InitScriptsDir = "/usr/local/k8shell/system" // EnvInitFirstRun is injected into every init script's environment. It is // "true" when the script has not previously completed successfully in this // workspace and "false" when it is being re-run (only InitScript.Always // scripts are ever re-run). EnvInitFirstRun = "K8SHELL_INIT_FIRST_RUN" )
const (
DEFAULT_MAX_PACKET_SIZE = 1 << 15 // 32 KB
)
Maximum packet size for streaming data
Variables ¶
var ( K8SHELLD_VERSION = "0.0.0" K8SHELLD_COMMIT = "0000000" )
Functions ¶
func BlueprintApps ¶
func BlueprintApps(bpApps map[string]commonmodels.AppSpec) map[string]*commonmodels.AppSpec
BlueprintApps converts the blueprint's value-map of AppSpec to the pointer-map used internally by AppManager. It also sets the Name field from the map key.
func ExpandSplash ¶
ExpandSplash executes the splash string as a Go template with the supplied variables and normalises newlines to \r\n for correct PTY rendering. If template parsing or execution fails the original splash string is returned unchanged so a misconfigured template never breaks the shell startup.
func LoadBlueprint ¶
func LoadBlueprint(path string) (*commonmodels.Blueprint, error)
LoadBlueprint reads and unmarshals the blueprint YAML at the given path. The file is expected to have the structure:
metadata: ... blueprint: <blueprint fields>
func LoadProfile ¶ added in v0.16.0
func LoadProfile(path string) (*commonmodels.UserProfile, error)
LoadProfile reads and unmarshals the workspace user's profile YAML at the given path. The file is the flat profile itself, e.g.:
username: bruckins uid: 166548839 gid: 166548839 ...
Types ¶
type Config ¶
Config is now identical to k8shelld.Config. Splash, Podman, EnableApps and Apps are no longer in the daemon config — they come from the blueprint.
type SplashVars ¶
type SplashVars struct {
// Version is the running k8shelld version (e.g. "1.2.3").
Version string
// Commit is the short git commit hash baked in at build time.
Commit string
// Username is the primary OS user configured for this instance.
Username string
// ShellUsername is the OS user that the current shell session runs as.
// This may differ from Username when the caller requested a different user.
ShellUsername string
// Hostname is the hostname of the container / machine.
Hostname string
// Date is today's date formatted as YYYY-MM-DD.
Date string
}
SplashVars holds all values that can be referenced inside the splash template. Use Go template syntax in the splash YAML field, e.g.:
splash: "k8shelld {{.Version}} | user: {{.Username}} | host: {{.Hostname}}"
To add a new variable in the future, simply add a field here and populate it in ExpandSplash — no changes are needed anywhere else.