Documentation
¶
Index ¶
- func FormatAdditionalUserData(input map[string]string) map[string]any
- func GenerateCloudConfig(config CloudConfig) ([]byte, error)
- func GetManagedCloudInitFields() []string
- type BaseUserData
- type CloudConfig
- type File
- type InitControlPlaneInput
- type InstallOption
- type JoinControlPlaneInput
- type JoinWorkerInput
- type SnapInstallData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAdditionalUserData ¶ added in v0.4.0
FormatAdditionalUserData formats additional user data into a map of any type.
func GenerateCloudConfig ¶
func GenerateCloudConfig(config CloudConfig) ([]byte, error)
GenerateCloudConfig generates userdata from a CloudConfig.
func GetManagedCloudInitFields ¶ added in v0.4.0
func GetManagedCloudInitFields() []string
GetManagedCloudInitFields returns a list of cloud init fields that are managed internally and user cannot provide them as additional user data.
Types ¶
type BaseUserData ¶
type BaseUserData struct { // KubernetesVersion is the Kubernetes version from the cluster object. KubernetesVersion string // SnapInstallData is the snap install data. SnapInstallData *SnapInstallData // 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 // AdditionalUserData is a key/value map of user defined cloud-init configuration. AdditionalUserData map[string]string // BootstrapConfig is the user supplied bootstrap configuration, taking // precedence over ConfigFileContents. BootstrapConfig string // ExtraFiles is a list of extra files to load on the host. ExtraFiles []File // ConfigFileContents is the generated bootstrap configuration. ConfigFileContents string // AirGapped declares that a custom installation script is to be used. AirGapped bool // The snap store proxy domain's scheme, e.g. "http" or "https" without "://" SnapstoreProxyScheme string // The snap store proxy domain SnapstoreProxyDomain string // The snap store proxy ID SnapstoreProxyID string // HTTPProxy is http_proxy configuration. HTTPProxy string // HTTPSProxy is https_proxy configuration. HTTPSProxy string // NoProxy is no_proxy configuration. NoProxy string // 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 // NodeToken is used for authenticating per-node k8sd endpoints. NodeToken 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"` // AdditionalUserData is an arbitrary key/value map of user defined configuration AdditionalUserData map[string]any `yaml:",inline"` }
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 // AuthToken is used to join more cluster nodes. AuthToken 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 InstallOption ¶ added in v0.2.0
type InstallOption string
const ( InstallOptionChannel InstallOption = "channel" InstallOptionRevision InstallOption = "revision" InstallOptionLocalPath InstallOption = "local-path" )
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.
type SnapInstallData ¶ added in v0.2.0
type SnapInstallData struct { // Option is the snap install option e.g. --channel, --revision. Option InstallOption // Value is the snap install value e.g. 1.30/stable, 123, /path/to/k8s.snap. Value string }