Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCloudConfig ¶
func GenerateCloudConfig(config CloudConfig) ([]byte, error)
GenerateCloudConfig generates userdata from a CloudConfig.
Types ¶
type BaseUserData ¶
type BaseUserData struct {
// KubernetesVersion is the Kubernetes version from the cluster object.
KubernetesVersion string
// BootCommands is a list of commands to run early in the boot process.
BootCommands []string
// PreRunCommands is a list of commands to run prior to k8s installation.
PreRunCommands []string
// PostRunCommands is a list of commands to run after k8s installation.
PostRunCommands []string
// ExtraFiles is a list of extra files to load on the host.
ExtraFiles []File
// ConfigFileContents is the contents of the k8s configuration file.
ConfigFileContents string
// AirGapped declares that a custom installation script is to be used.
AirGapped bool
// MicroclusterAddress is the address to use for microcluster.
MicroclusterAddress string
// MicroclusterPort is the port to use for microcluster.
MicroclusterPort int
// NodeName is the name of the node to set on microcluster.
NodeName string
}
type CloudConfig ¶
type CloudConfig struct {
// WriteFiles is a list of files cloud-init will create on the first boot.
WriteFiles []File `yaml:"write_files"`
// RunCommands is a list of commands to execute during the first boot.
RunCommands []string `yaml:"runcmd"`
// BootCommands is a list of commands to run early in the boot process.
BootCommands []string `yaml:"bootcmd,omitempty"`
}
CloudConfig is cloud-init userdata. The schema matches the examples found in https://cloudinit.readthedocs.io/en/latest/topics/examples.html.
func NewBaseCloudConfig ¶
func NewBaseCloudConfig(data BaseUserData) (CloudConfig, error)
func NewInitControlPlane ¶
func NewInitControlPlane(input InitControlPlaneInput) (CloudConfig, error)
NewInitControlPlane returns the user data string to be used on a controlplane instance.
func NewJoinControlPlane ¶
func NewJoinControlPlane(input JoinControlPlaneInput) (CloudConfig, error)
NewJoinControlPlane returns the user data string to be used on a controlplane instance.
func NewJoinWorker ¶
func NewJoinWorker(input JoinWorkerInput) (CloudConfig, error)
NewJoinWorker returns the user data string to be used on a controlplane instance.
type File ¶
type File struct {
// Content of the file to create.
Content string `yaml:"content"`
// Path where the file should be created.
Path string `yaml:"path"`
// Permissions of the file to create, e.g. "0600"
Permissions string `yaml:"permissions,omitempty"`
// Owner of the file to create, e.g. "root:root"
Owner string `yaml:"owner,omitempty"`
// Encoding is the file encoding, e.g. "base64"
Encoding string `yaml:"encoding,omitempty"`
}
File is a file that cloud-init will create.
func FilesFromAPI ¶
func FilesFromAPI(files []bootstrapv1.File) []File
type InitControlPlaneInput ¶
type InitControlPlaneInput struct {
BaseUserData
// Token is used to join more cluster nodes.
Token string
// K8sdProxyDaemonSet is the manifest that deploys k8sd-proxy to the cluster.
K8sdProxyDaemonSet string
}
InitControlPlaneInput defines the context to generate an init controlplane instance user data.
type JoinControlPlaneInput ¶
type JoinControlPlaneInput struct {
BaseUserData
// JoinToken is the token to use to join the cluster.
JoinToken string
}
JoinControlPlaneInput defines the context to generate a join controlplane instance user data.
type JoinWorkerInput ¶
type JoinWorkerInput struct {
BaseUserData
// JoinToken is the token to use to join the cluster.
JoinToken string
}
JoinWorkerInput defines the context to generate a join controlplane instance user data.