templates

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CommonFunctions = `` /* 13838-byte string literal not displayed */
View Source
const KindTemplate = `` /* 3581-byte string literal not displayed */
View Source
const KubeadmInitTemplate = `` /* 12946-byte string literal not displayed */

KubeadmInitTemplate is the bash script for initializing the first control-plane node

View Source
const KubeadmJoinTemplate = `` /* 2522-byte string literal not displayed */

KubeadmJoinTemplate is the bash script for joining nodes to the cluster

View Source
const KubeadmPrereqTemplate = `` /* 2721-byte string literal not displayed */

KubeadmPrereqTemplate is the bash script for installing Kubernetes binaries only This is used to prepare nodes before the actual init/join

View Source
const KubeadmTemplate = `` /* 18195-byte string literal not displayed */

Variables

This section is empty.

Functions

func GetCRISocket added in v0.2.7

func GetCRISocket(runtime string) (string, error)

GetCRISocket returns the CRI socket path based on the container runtime

func LoadCustomTemplate added in v0.3.0

func LoadCustomTemplate(tpl v1alpha1.CustomTemplate, baseDir string) ([]byte, error)

LoadCustomTemplate loads script content from the appropriate source. baseDir is used to resolve relative file paths (typically the directory containing the Holodeck config file).

func NewKernelTemplate added in v0.2.8

func NewKernelTemplate(env v1alpha1.Environment) (*bytes.Buffer, error)

NewKernelTemplate creates a new kernel template

func ValidateTemplateInputs added in v0.3.0

func ValidateTemplateInputs(env v1alpha1.Environment) error

ValidateTemplateInputs validates user-supplied fields that will be interpolated into shell scripts generated by the provisioner templates. This prevents command injection via shell metacharacters in version strings, git URLs, and file paths.

Types

type ContainerToolkit

type ContainerToolkit struct {
	ContainerRuntime string
	EnableCDI        bool

	// Source configuration
	Source      string // "package", "git", "latest"
	Version     string // For package source
	Channel     string // stable/experimental
	GitRepo     string
	GitRef      string
	GitCommit   string // Resolved short SHA
	TrackBranch string // For latest source
}

ContainerToolkit holds configuration for NVIDIA Container Toolkit installation.

func NewContainerToolkit

func NewContainerToolkit(env v1alpha1.Environment) (*ContainerToolkit, error)

NewContainerToolkit creates a ContainerToolkit from an Environment spec.

func (*ContainerToolkit) Execute

func (t *ContainerToolkit) Execute(tpl *bytes.Buffer, env v1alpha1.Environment) error

Execute renders the appropriate template based on source.

func (*ContainerToolkit) SetResolvedCommit added in v0.3.0

func (t *ContainerToolkit) SetResolvedCommit(shortSHA string)

SetResolvedCommit sets the resolved git commit SHA.

type Containerd

type Containerd struct {
	// Source configuration
	Source string // "package", "git", "latest"

	// Package source fields
	Version      string
	MajorVersion int

	// Git source fields
	GitRepo   string
	GitRef    string
	GitCommit string // Resolved short SHA

	// Latest source fields
	TrackBranch string
}

Containerd holds configuration for containerd installation.

func NewContainerd

func NewContainerd(env v1alpha1.Environment) (*Containerd, error)

NewContainerd creates a Containerd from an Environment spec.

func (*Containerd) Execute

func (t *Containerd) Execute(tpl *bytes.Buffer, env v1alpha1.Environment) error

Execute renders the appropriate template based on source.

func (*Containerd) SetResolvedCommit added in v0.3.0

func (t *Containerd) SetResolvedCommit(shortSHA string)

SetResolvedCommit sets the resolved git commit SHA.

type CriO

type CriO struct {
	// Source configuration
	Source string // "package", "git"

	// Package source fields
	Version string

	// Git source fields
	GitRepo   string
	GitRef    string
	GitCommit string
}

CriO holds configuration for CRI-O installation.

func NewCriO

func NewCriO(env v1alpha1.Environment) (*CriO, error)

NewCriO creates a CriO from an Environment spec.

func (*CriO) Execute

func (t *CriO) Execute(tpl *bytes.Buffer, env v1alpha1.Environment) error

Execute renders the appropriate template based on source.

func (*CriO) SetResolvedCommit added in v0.3.0

func (t *CriO) SetResolvedCommit(shortSHA string)

SetResolvedCommit sets the resolved git commit SHA.

type CustomTemplateExecutor added in v0.3.0

type CustomTemplateExecutor struct {
	Name            string
	Phase           v1alpha1.TemplatePhase
	Content         []byte
	Env             map[string]string
	ContinueOnError bool
	Timeout         int
}

CustomTemplateExecutor generates the bash script for a custom template.

func NewCustomTemplateExecutor added in v0.3.0

func NewCustomTemplateExecutor(tpl v1alpha1.CustomTemplate, content []byte) *CustomTemplateExecutor

NewCustomTemplateExecutor creates an executor for a loaded custom template.

func (*CustomTemplateExecutor) Execute added in v0.3.0

Execute writes the custom template script to the buffer.

type Docker

type Docker struct {
	// Source configuration
	Source string // "package", "git"

	// Package source fields
	Version string

	// Git source fields
	GitRepo   string
	GitRef    string
	GitCommit string
}

Docker holds configuration for Docker installation.

func NewDocker

func NewDocker(env v1alpha1.Environment) (*Docker, error)

NewDocker creates a Docker from an Environment spec.

func (*Docker) Execute

func (t *Docker) Execute(tpl *bytes.Buffer, env v1alpha1.Environment) error

Execute renders the appropriate template based on source.

func (*Docker) SetResolvedCommit added in v0.3.0

func (t *Docker) SetResolvedCommit(shortSHA string)

SetResolvedCommit sets the resolved git commit SHA.

type KubeadmConfig added in v0.2.7

type KubeadmConfig struct {
	// Template defines the kubeadm configuration
	// template to use for generating the configuration
	// if no template is provided, the default template
	// is used
	Template string

	CriSocket            string
	ClusterName          string
	KubernetesVersion    string
	ControlPlaneEndpoint string
	PodSubnet            string
	FeatureGates         string // Feature gates as comma-separated string
	RuntimeConfig        string // Runtime config (for feature gates) resource.k8s.io/v1beta1=true
	IsUbuntu             bool   // Whether the system is Ubuntu (for resolvConf)
}

KubeadmConfig holds configuration values for kubeadm

func NewKubeadmConfig added in v0.2.7

func NewKubeadmConfig(env v1alpha1.Environment) (*KubeadmConfig, error)

NewKubeadmConfig initializes a KubeadmConfig from a Kubernetes struct

func (*KubeadmConfig) GenerateKubeadmConfig added in v0.2.7

func (c *KubeadmConfig) GenerateKubeadmConfig() (string, error)

GenerateKubeadmConfig generates the kubeadm YAML configuration

func (*KubeadmConfig) ParseFeatureGates added in v0.2.7

func (c *KubeadmConfig) ParseFeatureGates() map[string]string

ParseFeatureGates converts "Feature1=true,Feature2=false" to a map of strings for YAML

type KubeadmInitConfig added in v0.3.0

type KubeadmInitConfig struct {
	Environment          *v1alpha1.Environment
	ControlPlaneEndpoint string
	IsHA                 bool
}

KubeadmInitConfig holds configuration for kubeadm init

func (*KubeadmInitConfig) Execute added in v0.3.0

func (c *KubeadmInitConfig) Execute(tpl *bytes.Buffer) error

Execute generates the kubeadm init script

type KubeadmJoinConfig added in v0.3.0

type KubeadmJoinConfig struct {
	ControlPlaneEndpoint string
	Token                string
	CACertHash           string
	CertificateKey       string // Only for control-plane joins
	IsControlPlane       bool
}

KubeadmJoinConfig holds configuration for kubeadm join

func (*KubeadmJoinConfig) Execute added in v0.3.0

func (c *KubeadmJoinConfig) Execute(tpl *bytes.Buffer) error

Execute generates the kubeadm join script

type KubeadmPrereqConfig added in v0.3.0

type KubeadmPrereqConfig struct {
	Environment *v1alpha1.Environment
}

KubeadmPrereqConfig holds configuration for installing K8s prerequisites

func (*KubeadmPrereqConfig) Execute added in v0.3.0

func (c *KubeadmPrereqConfig) Execute(tpl *bytes.Buffer) error

Execute generates the kubeadm prerequisites script

type Kubernetes

type Kubernetes struct {
	Version               string
	Installer             string
	KubeletReleaseVersion string
	Arch                  string
	CniPluginsVersion     string
	CalicoVersion         string
	CrictlVersion         string
	K8sEndpointHost       string
	K8sFeatureGates       string
	UseLegacyInit         bool
	CriSocket             string

	// Source configuration
	Source      string // "release", "git", "latest"
	GitRepo     string
	GitRef      string
	GitCommit   string // Resolved short SHA for git source
	TrackBranch string // For latest source

	// Kind exclusive
	KindConfig string
}

Kubernetes holds configuration for Kubernetes installation templates.

func NewKubernetes

func NewKubernetes(env v1alpha1.Environment) (*Kubernetes, error)

NewKubernetes creates a Kubernetes template configuration from an Environment.

func (*Kubernetes) Execute

func (k *Kubernetes) Execute(tpl *bytes.Buffer, env v1alpha1.Environment) error

Execute renders the appropriate Kubernetes template based on installer and source.

func (*Kubernetes) SetResolvedCommit added in v0.3.0

func (k *Kubernetes) SetResolvedCommit(shortSHA string)

SetResolvedCommit sets the resolved git commit SHA.

type NvDriver

type NvDriver struct {
	// Source configuration
	Source string // "package", "runfile", "git"

	// Package source fields
	Branch  string
	Version string

	// Runfile source fields
	RunfileURL      string
	RunfileChecksum string

	// Git source fields
	GitRepo   string
	GitRef    string
	GitCommit string // Resolved short SHA
}

NvDriver holds configuration for NVIDIA driver installation.

func NewNvDriver

func NewNvDriver(env v1alpha1.Environment) (*NvDriver, error)

NewNvDriver creates an NvDriver from an Environment spec.

func (*NvDriver) Execute

func (t *NvDriver) Execute(tpl *bytes.Buffer, env v1alpha1.Environment) error

Execute renders the appropriate template based on source.

func (*NvDriver) SetResolvedCommit added in v0.3.0

func (t *NvDriver) SetResolvedCommit(shortSHA string)

SetResolvedCommit sets the resolved git commit SHA.

type Template

type Template interface {
	Execute(tpl *bytes.Buffer, env v1alpha1.Environment) error
}

Template is the interface that wraps the Execute method.

Jump to

Keyboard shortcuts

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