2022-08-09 06:01:54 +00:00
package clusterplugin
type Role string
func ( n * Role ) MarshalYAML ( ) ( interface { } , error ) {
return string ( * n ) , nil
}
func ( n * Role ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error {
var val string
if err := unmarshal ( & val ) ; err != nil {
return err
}
* n = Role ( val )
return nil
}
2022-08-27 07:44:42 +00:00
func ( n * Role ) MarshalJSON ( ) ( [ ] byte , error ) {
return [ ] byte ( * n ) , nil
}
func ( n * Role ) UnmarshalJSON ( val [ ] byte ) error {
* n = Role ( val )
return nil
}
2022-08-09 06:01:54 +00:00
const (
// RoleInit denotes a special `RoleControlPlane` that can run special tasks to initialize the cluster. There will only ever be one node with this role in a cluster.
RoleInit = "init"
2022-08-12 13:49:41 +00:00
// RoleControlPlane denotes nodes that persist cluster information and host the kubernetes control plane.
2022-08-09 06:01:54 +00:00
RoleControlPlane = "controlplane"
2022-08-12 13:49:41 +00:00
// RoleWorker denotes a node that runs workloads in the cluster.
2022-08-09 06:01:54 +00:00
RoleWorker = "worker"
)
type Cluster struct {
2022-08-12 13:49:41 +00:00
// ClusterToken is a unique string that can be used to distinguish different clusters on networks with multiple clusters.
2022-08-27 07:44:42 +00:00
ClusterToken string ` yaml:"cluster_token,omitempty" json:"cluster_token,omitempty" `
2022-08-09 06:01:54 +00:00
2022-08-12 13:49:41 +00:00
// ControlPlaneHost is a host that all nodes can resolve and use for node registration.
2022-08-27 07:44:42 +00:00
ControlPlaneHost string ` yaml:"control_plane_host,omitempty" json:"control_plane_host,omitempty" `
2022-08-09 06:01:54 +00:00
2022-08-12 13:49:41 +00:00
// Role informs the sdk what kind of installation to manage on this device.
2022-08-27 07:44:42 +00:00
Role Role ` yaml:"role,omitempty" json:"role,omitempty" `
2022-08-09 06:01:54 +00:00
2023-10-30 16:22:46 +00:00
// Options are arbitrary values the sdk may be interested in. These values are not validated by Kairos and are simply forwarded to the sdk.
2022-08-27 07:44:42 +00:00
Options string ` yaml:"config,omitempty" json:"config,omitempty" `
2022-12-14 08:57:45 +00:00
2023-10-30 16:22:46 +00:00
// ProviderOptions are arbitrary, provider-specific values the sdk may be interested in. These values are not validated by Kairos and are simply forwarded to the sdk.
// ProviderOptions are meant to handle non-cluster values, while Options can be used for cluster-specific configuration values.
ProviderOptions map [ string ] string ` yaml:"providerConfig,omitempty" json:"providerConfig,omitempty" `
2022-12-14 08:57:45 +00:00
// Env contains the list of environment variables to be set on the cluster
Env map [ string ] string ` yaml:"env,omitempty" json:"env,omitempty" `
// CACerts list of trust certificates.
CACerts [ ] string ` yaml:"ca_certs,omitempty" json:"ca_certs,omitempty" `
2023-02-09 16:10:56 +00:00
// ImportLocalImages import local archive images to containerd on start.
ImportLocalImages bool ` yaml:"import_local_images,omitempty" json:"import_local_images,omitempty" `
// LocalImagesPath path to local archive images to load into containerd from the filesystem start
LocalImagesPath string ` yaml:"local_images_path,omitempty" json:"local_images_path,omitempty" `
2024-08-21 07:35:02 +00:00
// ClusterConfigPath path to the file where the final init config will be generated
2024-08-21 16:26:58 +00:00
ClusterConfigPath string ` yaml:"cluster_config_path,omitempty" json:"clusterConfigPath,omitempty" `
2022-08-09 06:01:54 +00:00
}
type Config struct {
2022-08-27 07:44:42 +00:00
Cluster * Cluster ` yaml:"cluster,omitempty" json:"cluster,omitempty" `
2022-08-09 06:01:54 +00:00
}